debug.Logger Extends Object
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.

Inheritance

Object
     goog.debug.Logger

Constructor

goog.debug.Logger(name)

Parameters

name :
The name of the Logger.

Instance Methods

Public Protected Private
addChild_(namelogger)
Adds a child to this logger. This is used for setting up the logger tree.
Arguments:
name :
The leaf name of the child.
logger :
The child logger.
code »
addHandler(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.
Arguments:
handler :
Handler function to add.
code »
callPublish_(logRecord)
Calls the handlers for publish.
Arguments:
logRecord :
The log record to publish.
code »
config(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
fine(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
finer(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
finest(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
getChildren()
Returns the children of this logger as a map of the child name to the logger.
Returns:   The map where the keys are the child leaf names and the values are the Logger objects.
code »
getEffectiveLevel()
Returns the effective level of the logger based on its ancestors' levels.
Returns:   The level.
code »
getLevel()
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.
Returns:   The level.
code »
getLogRecord(levelmsgopt_exception)
Creates a new log record and adds the exception (if present) to it.
Arguments:
level :
One of the level identifiers.
msg :
The string message.
opt_exception :
Error | Object
An exception associated with the message.
Returns:   A log record.
code »
getName()
Gets the name of this logger.
Returns:   The name of this logger.
code »
getParent()
Returns the parent of this logger.
Returns:   The parent logger or null if this is the root.
code »
info(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
isLoggable(level)
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.
Arguments:
level :
The level to check.
Returns:   Whether the message would be logged.
code »
log(levelmsgopt_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.
Arguments:
level :
One of the level identifiers.
msg :
The string message.
opt_exception :
Error | Object
An exception associated with the message.
code »
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.
Arguments:
logRecord :
A log record to log.
code »
removeHandler(handler)
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.
Arguments:
handler :
Handler function to remove.
Returns:   Whether the handler was removed.
code »
setLevel(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.
Arguments:
level :
The new level.
code »
setParent_(parent)
Sets the parent of this logger. This is used for setting up the logger tree.
Arguments:
parent :
The parent logger.
code »
severe(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
shout(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »
warning(msgopt_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.
Arguments:
msg :
The string message.
opt_exception :
Error
An exception associated with the message.
code »

Instance Properties

Level that this logger only filters above. Null indicates it should inherit from the parent.
Code »

Static Methods

goog.debug.Logger.getLogger(name)
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.
Arguments:
name :
A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as goog.net.BrowserChannel.
Returns:   The named logger.
code »

Package debug

Package Reference