Home

# Class goog.debug.Logger

The Logger is an object used for logging debug messages. Loggers are normally named, using a hierarchical dot-separated namespace. Logger names can be arbitrary strings, but they should normally be based on the package name or class name of the logged component, such as goog.net.BrowserChannel. The Logger object is loosely based on the java class java.util.logging.Logger. It supports different levels of filtering for different loggers. The logger object should never be instantiated by application code. It should always use the goog.debug.Logger.getLogger function.

Instance Method Summary
| `addChild_(string name, ?goog.debug.Logger logger)` Adds a child to this logger. This is used for setting up the logger tree.
| `addHandler(?Function handler)` Adds a handler to the logger. This doesn't use the event system because we want to be able to add logging to the event system.
| `callPublish_(?goog.debug.LogRecord logRecord)` Calls the handlers for publish.
| `config(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.CONFIG level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `doLogRecord_(?goog.debug.LogRecord logRecord)` Log a LogRecord.
| `doLogRecord_()`
| `fine(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.FINE level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `finer(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.FINER level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `finest(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.FINEST level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `getChildren() ⇒ !Object` Returns the children of this logger as a map of the child name to the logger.
| `getEffectiveLevel() ⇒ ?goog.debug.Logger.Level` Returns the effective level of the logger based on its ancestors' levels.
| `getLevel() ⇒ ?goog.debug.Logger.Level` Gets the log level specifying which message levels will be logged by this logger. Message levels lower than this value will be discarded. The level value Level.OFF can be used to turn off logging. If the level is null, it means that this node should inherit its level from its nearest ancestor with a specific (non-null) level value.
| `getLogRecord(?goog.debug.Logger.Level level, string msg, ?Object= opt_exception) ⇒ !goog.debug.LogRecord` Creates a new log record and adds the exception (if present) to it.
| `getName() ⇒ string` Gets the name of this logger.
| `getParent() ⇒ ?goog.debug.Logger` Returns the parent of this logger.
| `info(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.INFO level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `isLoggable(?goog.debug.Logger.Level level) ⇒ boolean` Check if a message of the given level would actually be logged by this logger. This check is based on the Loggers effective level, which may be inherited from its parent.
| `log(?goog.debug.Logger.Level level, string msg, ?Object= opt_exception)` Log a message. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `logRecord(?goog.debug.LogRecord logRecord)` Log a LogRecord. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `removeHandler(?Function handler) ⇒ boolean` Removes a handler from the logger. This doesn't use the event system because we want to be able to add logging to the event system.
| `setLevel(?goog.debug.Logger.Level level)` Set the log level specifying which message levels will be logged by this logger. Message levels lower than this value will be discarded. The level value Level.OFF can be used to turn off logging. If the new level is null, it means that this node should inherit its level from its nearest ancestor with a specific (non-null) level value.
| `setParent_(?goog.debug.Logger parent)` Sets the parent of this logger. This is used for setting up the logger tree.
| `severe(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.SEVERE level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `shout(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.SHOUT level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
| `warning(string msg, ?Error= opt_exception)` Log a message at the Logger.Level.WARNING level. If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.

Static Method Summary

`getLogger(string name) ⇒ !goog.debug.Logger`

Find or create a logger for a named subsystem. If a logger has already been created with the given name it is returned. Otherwise a new logger is created. If a new logger is created its log level will be configured based on the LogManager configuration and it will configured to also send logging output to its parent's handlers. It will be registered in the LogManager global namespace.

| `logToProfilers(string msg)` Logs a message to profiling tools, if available. {@see http://code.google.com/webtoolkit/speedtracer/logging-api.html} {@see http://msdn.microsoft.com/en-us/library/dd433074(VS.85).aspx}