- implemented amb855 - LogAction()
- changed base plugins to use LogAction() where appropriate --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401384
This commit is contained in:
@@ -62,6 +62,16 @@ enum Action
|
||||
Plugin_Stop = 4, /**< Immediately stop the hook chain and handle the original */
|
||||
};
|
||||
|
||||
/**
|
||||
* Specifies identity types.
|
||||
*/
|
||||
enum Identity
|
||||
{
|
||||
Identity_Core = 0,
|
||||
Identity_Extension = 1,
|
||||
Identity_Plugin = 2
|
||||
};
|
||||
|
||||
public PlVers:__version =
|
||||
{
|
||||
version = SOURCEMOD_PLUGINAPI_VERSION,
|
||||
|
||||
@@ -232,3 +232,28 @@ native bool:WriteFileLine(Handle:hndl, const String:format[], any:...);
|
||||
* @return Time value, or -1 on failure.
|
||||
*/
|
||||
native GetFileTime(const String:file[], FileTimeMode:tmode);
|
||||
|
||||
/**
|
||||
* Same as LogToFile(), except uses an open file Handle. The file must
|
||||
* be opened in text appending mode.
|
||||
*
|
||||
* @param hndl Handle to the file.
|
||||
* @param message Message format.
|
||||
* @param ... Message format parameters.
|
||||
* @noreturn
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native LogToOpenFile(Handle:hndl, const String:message[], any:...);
|
||||
|
||||
/**
|
||||
* Same as LogToFileEx(), except uses an open file Handle. The file must
|
||||
* be opened in text appending mode.
|
||||
*
|
||||
* @param hndl Handle to the file.
|
||||
* @param message Message format.
|
||||
* @param ... Message format parameters.
|
||||
* @noreturn
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native LogToOpenFileEx(Handle:hndl, const String:message[], any:...);
|
||||
|
||||
|
||||
@@ -166,6 +166,26 @@ forward OnServerCfg();
|
||||
*/
|
||||
forward OnAllPluginsLoaded();
|
||||
|
||||
/**
|
||||
* Called when an action is going to be logged.
|
||||
*
|
||||
* @param source Handle to the object logging the action, or INVALID_HANDLE
|
||||
* if Core is logging the action.
|
||||
* @param ident Type of object logging the action (plugin, ext, or core).
|
||||
* @param client Client the action is from; 0 for server, -1 if not applicable.
|
||||
* @param target Client the action is targetting, or -1 if not applicable.
|
||||
* @param message Message that is being logged.
|
||||
* @return Plugin_Continue will cause Core to defaulty log the message.
|
||||
* Plugin_Handled will stop Core from logging the message.
|
||||
* Plugin_Stop is the same as Handled, but prevents any other
|
||||
* plugins from handling the message.
|
||||
*/
|
||||
forward Action:OnLogAction(Handle:source,
|
||||
Identity:ident,
|
||||
client,
|
||||
target,
|
||||
const String:message[]);
|
||||
|
||||
/**
|
||||
* Returns the calling plugin's Handle.
|
||||
*
|
||||
@@ -264,7 +284,8 @@ native SetFailState(const String:string[]);
|
||||
native ThrowError(const String:fmt[], any:...);
|
||||
|
||||
/**
|
||||
* Logs a plugin message to the SourceMod logs.
|
||||
* Logs a plugin message to the SourceMod logs. The log message will be
|
||||
* prefixed by the plugin's logtag (filename).
|
||||
*
|
||||
* @param format String format.
|
||||
* @param ... Format arguments.
|
||||
@@ -272,6 +293,53 @@ native ThrowError(const String:fmt[], any:...);
|
||||
*/
|
||||
native LogMessage(const String:format[], any:...);
|
||||
|
||||
/**
|
||||
* Logs a message to the SourceMod logs without any plugin logtag. This is
|
||||
* useful for re-routing messages from other plugins, for example, messages
|
||||
* from LogAction().
|
||||
*
|
||||
* @param format String format.
|
||||
* @param ... Format arguments.
|
||||
* @noreturn
|
||||
*/
|
||||
native LogMessageEx(const String:format[], any:...);
|
||||
|
||||
/**
|
||||
* Logs a message to any file. The log message will be in the normal
|
||||
* SourceMod format, with the plugin logtag prepended.
|
||||
*
|
||||
* @param file File to write the log message in.
|
||||
* @param format String format.
|
||||
* @param ... Format arguments.
|
||||
* @noreturn
|
||||
* @error File could not be opened/written.
|
||||
*/
|
||||
native LogToFile(const String:file[], const String:format[], any:...);
|
||||
|
||||
/**
|
||||
* Same as LogToFile(), except no plugin logtag is prepended.
|
||||
*
|
||||
* @param file File to write the log message in.
|
||||
* @param format String format.
|
||||
* @param ... Format arguments.
|
||||
* @noreturn
|
||||
* @error File could not be opened/written.
|
||||
*/
|
||||
native LogToFileEx(const String:file[], const String:format[], any:...);
|
||||
|
||||
/**
|
||||
* Logs an action from a command or event whereby interception and routing may
|
||||
* be important. This is intended to be a logging version of ShowActivity().
|
||||
*
|
||||
* @param client Client performing the action, 0 for server, or -1 if not
|
||||
* applicable.
|
||||
* @param target Client being targetted, or -1 if not applicable.
|
||||
* @param message Message format.
|
||||
* @param ... Message formatting parameters.
|
||||
* @noreturn
|
||||
*/
|
||||
native LogAction(client, target, const String:message[], any:...);
|
||||
|
||||
/**
|
||||
* Logs a plugin error message to the SourceMod logs.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user