plugins/include/logging.inc
branchrefac-jit
changeset 2284 026da5437111
parent 2192 7602d7fb60d9
child 2288 15c77b21589a
     1.1 --- a/plugins/include/logging.inc	Fri Jul 11 06:51:21 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,153 +0,0 @@
     1.4 -/**
     1.5 - * vim: set ts=4 :
     1.6 - * =============================================================================
     1.7 - * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     1.8 - * =============================================================================
     1.9 - *
    1.10 - * This file is part of the SourceMod/SourcePawn SDK.
    1.11 - *
    1.12 - * This program is free software; you can redistribute it and/or modify it under
    1.13 - * the terms of the GNU General Public License, version 3.0, as published by the
    1.14 - * Free Software Foundation.
    1.15 - * 
    1.16 - * This program is distributed in the hope that it will be useful, but WITHOUT
    1.17 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.18 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.19 - * details.
    1.20 - *
    1.21 - * You should have received a copy of the GNU General Public License along with
    1.22 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    1.23 - *
    1.24 - * As a special exception, AlliedModders LLC gives you permission to link the
    1.25 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    1.26 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    1.27 - * by the Valve Corporation.  You must obey the GNU General Public License in
    1.28 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    1.29 - * this exception to all derivative works.  AlliedModders LLC defines further
    1.30 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.31 - * or <http://www.sourcemod.net/license.php>.
    1.32 - *
    1.33 - * Version: $Id$
    1.34 - */
    1.35 - 
    1.36 -#if defined _sm_logging_included
    1.37 - #endinput
    1.38 -#endif
    1.39 -#define _sm_logging_included
    1.40 -
    1.41 -/**
    1.42 - * Logs a plugin message to the SourceMod logs.  The log message will be 
    1.43 - * prefixed by the plugin's logtag (filename).
    1.44 - *
    1.45 - * @param format		String format.
    1.46 - * @param ...			Format arguments.
    1.47 - * @noreturn
    1.48 - */
    1.49 -native LogMessage(const String:format[], any:...);
    1.50 -
    1.51 -/**
    1.52 - * Logs a message to the SourceMod logs without any plugin logtag.  This is 
    1.53 - * useful for re-routing messages from other plugins, for example, messages 
    1.54 - * from LogAction().
    1.55 - *
    1.56 - * @param format		String format.
    1.57 - * @param ...			Format arguments.
    1.58 - * @noreturn
    1.59 - */
    1.60 -native LogMessageEx(const String:format[], any:...);
    1.61 -
    1.62 -/**
    1.63 - * Logs a message to any file.  The log message will be in the normal 
    1.64 - * SourceMod format, with the plugin logtag prepended.
    1.65 - *
    1.66 - * @param file			File to write the log message in.
    1.67 - * @param format		String format.
    1.68 - * @param ...			Format arguments.
    1.69 - * @noreturn
    1.70 - * @error				File could not be opened/written.
    1.71 - */
    1.72 -native LogToFile(const String:file[], const String:format[], any:...);
    1.73 -
    1.74 -/**
    1.75 - * Same as LogToFile(), except no plugin logtag is prepended.
    1.76 - *
    1.77 - * @param file			File to write the log message in.
    1.78 - * @param format		String format.
    1.79 - * @param ...			Format arguments.
    1.80 - * @noreturn
    1.81 - * @error				File could not be opened/written.
    1.82 - */
    1.83 -native LogToFileEx(const String:file[], const String:format[], any:...);
    1.84 -
    1.85 -/**
    1.86 - * Logs an action from a command or event whereby interception and routing may 
    1.87 - * be important.  This is intended to be a logging version of ShowActivity().
    1.88 - *
    1.89 - * @param client		Client performing the action, 0 for server, or -1 if not 
    1.90 - *						applicable.
    1.91 - * @param target		Client being targetted, or -1 if not applicable.
    1.92 - * @param message		Message format.
    1.93 - * @param ...			Message formatting parameters.
    1.94 - * @noreturn
    1.95 - */
    1.96 -native LogAction(client, target, const String:message[], any:...);
    1.97 -
    1.98 -/**
    1.99 - * Logs a plugin error message to the SourceMod logs.
   1.100 - *
   1.101 - * @param format		String format.
   1.102 - * @param ...			Format arguments.
   1.103 - * @noreturn
   1.104 - */
   1.105 -native LogError(const String:format[], any:...);
   1.106 -
   1.107 -/**
   1.108 - * Called when an action is going to be logged.
   1.109 - *
   1.110 - * @param source		Handle to the object logging the action, or INVALID_HANDLE 
   1.111 - *						if Core is logging the action.
   1.112 - * @param ident			Type of object logging the action (plugin, ext, or core).
   1.113 - * @param client		Client the action is from; 0 for server, -1 if not applicable.
   1.114 - * @param target		Client the action is targetting, or -1 if not applicable.
   1.115 - * @param message		Message that is being logged.
   1.116 - * @return				Plugin_Continue will cause Core to defaulty log the message.
   1.117 - *						Plugin_Handled will stop Core from logging the message.
   1.118 - * 						Plugin_Stop is the same as Handled, but prevents any other 
   1.119 - *						plugins from handling the message.
   1.120 - */
   1.121 -forward Action:OnLogAction(Handle:source, 
   1.122 -						   Identity:ident,
   1.123 -						   client,
   1.124 -						   target,
   1.125 -						   const String:message[]);
   1.126 -
   1.127 -/**
   1.128 - * Called when a game log message is received.
   1.129 - *
   1.130 - * Any Log*() functions called within this callback will not recursively 
   1.131 - * pass through.  That is, they will log directly, bypassing this callback.
   1.132 - *
   1.133 - * Note that this does not capture log messages from the engine.  It only 
   1.134 - * captures log messages being sent from the game/mod itself.
   1.135 - *
   1.136 - * @param message		Message contents.
   1.137 - * @return				Plugin_Handled or Plugin_Stop will prevent the message 
   1.138 - * 						from being written to the log file.
   1.139 - */
   1.140 -functag GameLogHook Action:public(const String:message[]);
   1.141 -
   1.142 -/**
   1.143 - * Adds a game log hook.
   1.144 - *
   1.145 - * @param hook			Hook function.
   1.146 - * @noreturn
   1.147 - */
   1.148 -native AddGameLogHook(GameLogHook:hook);
   1.149 -
   1.150 -/**
   1.151 - * Removes a game log hook.
   1.152 - *
   1.153 - * @param hook			Hook function.
   1.154 - * @noreturn
   1.155 - */
   1.156 -native RemoveGameLogHook(GameLogHook:hook);