Jaxer.Log : Object
Return to: Jaxer Framework index

Log is a static object meant to be shared across the framework and perhaps even the user's code. In a module, use it to create a module-specific logger and then log with it.

Platform Support

Jaxer Server Framework Jaxer Client Framework
1.0 no

Functions

Method Action Jaxer Server Framework Jaxer Client Framework
static addAppender(String name, Jaxer.Log.Appender appender) : void
Add an appender to the referenced Log object

(Advanced)
Show Details 1.0 no

Parameters
String name The name of the appender
Jaxer.Log.Appender appender An instance of the appender. It should be derived from Jaxer.Log.Appender.

static getAppender(String name) : Jaxer.Log.Appender
Get an appender reference from the referenced Log object

(Advanced)
Show Details 1.0 no

Parameters
String name The name of the appender to look for

Returns
Jaxer.Log.Appender The appender instance

static getLevelNames() : Array<String>
Return a array of implemented Logger levelnames e.g. "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"

(Advanced)
Show Details 1.0 no

Returns
Array<String>

static getSortedModuleNames() : Array
Gets a sorted array of all the currently-defined modules.

(Advanced)
Show Details 1.0 no

Returns
Array An array of strings, sorted alphabetically, of the names of modules for which ModuleLoggers have been defined.

static removeAppender(String name) : void
Remove the specified appender from the referenced Log object

(Advanced)
Show Details 1.0 no

Parameters
String name The name of the appender to use.

static debug(String message, [Error exception,] [Function inFunction]) : void
Logs a message at the "DEBUG" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.DEBUG. This is the second-most verbose level - instrument your code with debug() calls in those places where debugging is likely to benefit from them.
Show Details 1.0 no

Parameters
String message The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
Error exception (optional)An optional error or exception to be logged with this message
Function inFunction (optional)An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.

static error(String message, [Error exception,] [Function inFunction]) : void
Logs a message at the "ERROR" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.ERROR. Use this to log non-fatal but nonetheless real errors.
Show Details 1.0 no

Parameters
String message The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
Error exception (optional)An optional error or exception to be logged with this message
Function inFunction (optional)An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.

static fatal(String message, [Error exception,] [Function inFunction]) : void
Logs a message at the "FATAL" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.FATAL. Use this to log the most serious errors.
Show Details 1.0 no

Parameters
String message The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
Error exception (optional)An optional error or exception to be logged with this message
Function inFunction (optional)An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.

static forModule(String moduleName) : Jaxer.Log.ModuleLogger
Lazily creates a logger for the given module name, if needed, and in any case returns it. The referenced Log object knows to create log entries marked as belonging to the specific module.
Show Details 1.0 no

Parameters
String moduleName The name of the module (just an identifier string).

Returns
Jaxer.Log.ModuleLogger The module-specific logger to use for log entries.

static getLevel() : Jaxer.Log.Level
Get the logging level of the generic logger
Show Details 1.0 no

Returns
Jaxer.Log.Level The level below which non-module-specific messages will not be logged

static getStackTrace([String linePrefix,] [Number framesToSkip]) : String
Get the current JavaScript stack trace.
Show Details 1.0 no

Parameters
String linePrefix (optional)An optional prefix (e.g. whitespace for indentation) to prepend to every line of the stack trace
Number framesToSkip (optional)An optional number of frames to skip before starting to trace the remaining frames

Returns
String The stack trace as a string consisting of a number of lines, starting at the deepest frame

static hasModule(String moduleName) : Boolean
Returns a boolean to indicate whether the referenced Log object is wired to do logging for the provided modulename
Show Details 1.0 no

Parameters
String moduleName The name of the module to look up

Returns
Boolean

static info(String message, [Error exception,] [Function inFunction]) : void
Logs a message at the "INFO" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.INFO. By default, modules are set to show messages at this level, so use info() when you want to show log messages without needing to set the level to more verbose than usual, but don't keep info() messages in your code long term.
Show Details 1.0 no

Parameters
String message The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
Error exception (optional)An optional error or exception to be logged with this message
Function inFunction (optional)An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.

static setAllModuleLevels(Jaxer.Log.Level level) : void
Set the logging level on ALL modules to level provided for the referenced Log object
Show Details 1.0 no

Parameters
Jaxer.Log.Level level The new level to use for all of them

static setLevel(Jaxer.Log.Level level) : void
Set the logging level for the generic logger (the one that's not module- specific)
Show Details 1.0 no

Parameters
Jaxer.Log.Level level The level to use on the generic logger messages below this level will not be logged.

static trace(String message, [Error exception,] [Function inFunction]) : void
Logs a message at the "TRACE" level. The message will only be appended to the log if the level for that module (and that appender) is set at Jaxer.Log.TRACE. This is the most verbose level - instrument your code liberally with trace() calls to be able to pinpoint any issues.
Show Details 1.0 no

Parameters
String message The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
Error exception (optional)An optional error or exception to be logged with this message
Function inFunction (optional)An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.

static warn(String message, [Error exception,] [Function inFunction]) : void
Logs a message at the "WARN" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.WARN. Use this to warn of any unusual or unexpected, but not necessarily erroneous, conditions.
Show Details 1.0 no

Parameters
String message The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
Error exception (optional)An optional error or exception to be logged with this message
Function inFunction (optional)An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.

aptana_docs