goog.debug.Logger
Classgoog.debug.Logger(name)
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.
name
{string
}
.ENABLE_HIERARCHY
goog.debug.Logger.Level
ClassThe Level class defines a set of standard logging levels that can be used to control logging output. The logging Level objects are ordered and are specified by ordered integers. Enabling logging at a given level also enables logging at all higher levels.
Clients should normally use the predefined Level constants such as Level.SEVERE.
The levels in descending order are:
.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.
handler
{Function
}
.config(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.fine(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.finer(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.finest(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.getChildren()
Returns the children of this logger as a map of the child name to the logger.
Object
}
.getEffectiveLevel()
Returns the effective level of the logger based on its ancestors' levels.
goog.debug.Logger.Level
}
.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.
goog.debug.Logger.Level
}
.getLogRecord(level, msg, opt_exception)
Creates a new log record and adds the exception (if present) to it.
level
{goog.debug.Logger.Level
}
msg
{string
}
opt_exception
{Error
|Object
=}
goog.debug.LogRecord
}
.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.
name
{string
}
goog.debug.Logger
}
.getName()
Gets the name of this logger.
string
}
.getParent()
Returns the parent of this logger.
goog.debug.Logger
}
.info(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.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.
level
{goog.debug.Logger.Level
}
boolean
}
.log(level, msg, 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.
level
{goog.debug.Logger.Level
}
msg
{string
}
opt_exception
{Error
|Object
=}
.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.
logRecord
{goog.debug.LogRecord
}
.logToProfilers(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}
msg
{string
}
.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.
handler
{Function
}
boolean
}
.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.
level
{goog.debug.Logger.Level
}
.severe(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.shout(msg, 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.
msg
{string
}
opt_exception
{Error
=}
.warning(msg, 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.
msg
{string
}
opt_exception
{Error
=}