| Package | com.threerings.util |
| Class | public class Log |
| Property | Defined by | ||
|---|---|---|---|
| _levels : Object [static] A cache of log levels, copied from _setLevels.
| Log | ||
| _module : String The module to which this log instance applies.
| Log | ||
| _setLevels : Object [static] The configured log levels.
| Log | ||
| _targets : Array [static] Other registered LogTargets, besides the trace log.
| Log | ||
| Method | Defined by | ||
|---|---|---|---|
|
[static]
Add a logging target.
| Log | ||
|
debug(... args):void
Log a message with 'debug' priority.
| Log | ||
|
dumpStack(msg:String = "dumpStack"):void
[static]
A convenience function for quickly printing a stack trace
to the log, useful for debugging.
| Log | ||
|
error(... args):void
Log a message with 'error' priority.
| Log | ||
|
[static]
Retrieve a Log for the specified module.
| Log | ||
|
info(... args):void
Log a message with 'info' priority.
| Log | ||
|
logStackTrace(error:Error):void
Log just a stack trace with 'warning' priority.
| Log | ||
|
removeTarget(target:LogTarget):void
[static]
Remove a logging target.
| Log | ||
|
setLevel(module:String, level:int):void
[static]
Set the log level for the specified module.
| Log | ||
|
setLevels(settingString:String):void
[static]
Parses a String in the form of ":info;com.foo.game:debug;com.bar.util:warning"
Semicolons separate modules, colons separate a module name from the log level.
| Log | ||
|
testing(... params):void
[static]
A convenience function for quickly and easily inserting printy
statements during application development.
| Log | ||
|
warning(... args):void
Log a message with 'warning' priority.
| Log | ||
| Method | Defined by | ||
|---|---|---|---|
|
argToString(arg:*):String
Safely format the argument to a String, calling the function if it is one.
| Log | ||
|
doLog(level:int, args:Array):void
| Log | ||
|
formatMessage(level:int, args:Array):String
| Log | ||
|
getLevel(module:String):int
[static]
Get the logging level for the specified module.
| Log | ||
|
getTimeStamp():String
| Log | ||
|
stringToLevel(s:String):int
[static]
| Log | ||
| Constant | Defined by | ||
|---|---|---|---|
| DEBUG : int = 0 [static] Log level constants.
| Log | ||
| ERROR : int = 3 [static]
| Log | ||
| INFO : int = 1 [static]
| Log | ||
| OFF : int = 4 [static]
| Log | ||
| WARNING : int = 2 [static]
| Log | ||
| Constant | Defined by | ||
|---|---|---|---|
| LEVEL_NAMES : Array [static] The outputted names of each level.
| Log | ||
| _levels | property |
protected static var _levels:ObjectA cache of log levels, copied from _setLevels.
| _module | property |
protected var _module:StringThe module to which this log instance applies.
| _setLevels | property |
protected static var _setLevels:ObjectThe configured log levels.
| _targets | property |
protected static var _targets:ArrayOther registered LogTargets, besides the trace log.
| addTarget | () | method |
public static function addTarget(target:LogTarget):voidAdd a logging target.
Parameterstarget:LogTarget |
| argToString | () | method |
protected function argToString(arg:*):StringSafely format the argument to a String, calling the function if it is one.
Parametersarg:* |
String |
| debug | () | method |
public function debug(... args):voidLog a message with 'debug' priority.
Parameters... args — The first argument is the actual message to log. After that, each pair
of parameters is printed in key/value form, the benefit being that if no log
message is generated then toString() will not be called on the values.
If any argument is a function, it is invoked with no args, so that you may avoid
converting detailed data into a String unless the message is actually logged.
A final parameter may be an Error, in which case the stack trace is printed.
|
log.debug("Message", "key1", value1, "key2", value2, optionalError);
| doLog | () | method |
protected function doLog(level:int, args:Array):voidParameters
level:int |
|
args:Array |
| dumpStack | () | method |
public static function dumpStack(msg:String = "dumpStack"):voidA convenience function for quickly printing a stack trace to the log, useful for debugging.
Parametersmsg:String (default = "dumpStack") |
| error | () | method |
public function error(... args):voidLog a message with 'error' priority.
Parameters... args — The first argument is the actual message to log. After that, each pair
of parameters is printed in key/value form, the benefit being that if no log
message is generated then toString() will not be called on the values.
If any argument is a function, it is invoked with no args, so that you may avoid
converting detailed data into a String unless the message is actually logged.
A final parameter may be an Error, in which case the stack trace is printed.
|
log.error("Message", "key1", value1, "key2", value2, optionalError);
| formatMessage | () | method |
protected function formatMessage(level:int, args:Array):StringParameters
level:int |
|
args:Array |
String |
| getLevel | () | method |
protected static function getLevel(module:String):intGet the logging level for the specified module.
Parametersmodule:String |
int |
| getLog | () | method |
public static function getLog(moduleSpec:*):LogRetrieve a Log for the specified module.
ParametersmoduleSpec:* — can be a String of the module name, or any Object or Class to
have the module name be the full package and name of the class (recommended).
|
Log |
| getTimeStamp | () | method |
protected function getTimeStamp():String
Returns
String |
| info | () | method |
public function info(... args):voidLog a message with 'info' priority.
Parameters... args — The first argument is the actual message to log. After that, each pair
of parameters is printed in key/value form, the benefit being that if no log
message is generated then toString() will not be called on the values.
If any argument is a function, it is invoked with no args, so that you may avoid
converting detailed data into a String unless the message is actually logged.
A final parameter may be an Error, in which case the stack trace is printed.
|
log.info("Message", "key1", value1, "key2", value2, optionalError);
| logStackTrace | () | method |
public function logStackTrace(error:Error):voidLog just a stack trace with 'warning' priority. Deprecated, sorta. Just use warning("Message", error);
Parameterserror:Error |
| removeTarget | () | method |
public static function removeTarget(target:LogTarget):voidRemove a logging target.
Parameterstarget:LogTarget |
| setLevel | () | method |
public static function setLevel(module:String, level:int):voidSet the log level for the specified module.
Parametersmodule:String — The smallest prefix desired to configure a log level.
For example, you can set the global level with Log.setLevel("", Log.INFO);
Then you can Log.setLevel("com.foo.game", Log.DEBUG). Now, everything
logs at INFO level except for modules within com.foo.game, which is at DEBUG.
|
|
level:int |
| setLevels | () | method |
public static function setLevels(settingString:String):voidParses a String in the form of ":info;com.foo.game:debug;com.bar.util:warning" Semicolons separate modules, colons separate a module name from the log level. An empty string specifies the top-level (global) module.
ParameterssettingString:String |
| stringToLevel | () | method |
protected static function stringToLevel(s:String):intParameters
s:String |
int |
| testing | () | method |
public static function testing(... params):voidA convenience function for quickly and easily inserting printy statements during application development.
Parameters... params |
| warning | () | method |
public function warning(... args):voidLog a message with 'warning' priority.
Parameters... args — The first argument is the actual message to log. After that, each pair
of parameters is printed in key/value form, the benefit being that if no log
message is generated then toString() will not be called on the values.
If any argument is a function, it is invoked with no args, so that you may avoid
converting detailed data into a String unless the message is actually logged.
A final parameter may be an Error, in which case the stack trace is printed.
|
log.warning("Message", "key1", value1, "key2", value2, optionalError);
| DEBUG | constant |
public static const DEBUG:int = 0Log level constants.
| ERROR | constant |
public static const ERROR:int = 3
| INFO | constant |
public static const INFO:int = 1
| LEVEL_NAMES | constant |
protected static const LEVEL_NAMES:ArrayThe outputted names of each level. The last one isn't used, it corresponds with OFF.
| OFF | constant |
public static const OFF:int = 4
| WARNING | constant |
public static const WARNING:int = 2