Constructor
new Logger(name, opt_levelopt)
| Name | Type | Attributes | Description |
|---|---|---|---|
name | string | the name of this logger. | |
opt_level | Level | <optional> | the initial level for this logger. |
- Source
Methods
addHandler(handler)
Adds a handler to this logger. The handler will be invoked for each message logged with this instance, or any of its descendants.
| Name | Type | Description |
|---|---|---|
handler | function | the handler to add. |
- Source
debug(loggable)
Logs a message at the Level.DEBUG log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source
deprecate(id, message)
Logs a deprecation notice at the Level.WARNING log level, once per id for this logger's lifetime — a repeat call with the same id is a no-op, matching the once-only behavior util.deprecate gives by call-site identity, but keyed on a stable id instead so it survives being wrapped, rebound, or called through multiple paths.
id is only claimed once the notice is actually loggable at this logger's effective level — under the default Level.OFF root level, a call here logs nothing and leaves id unclaimed, so a later call (once logging is enabled) still gets to report it instead of finding it already silently used up.
| Name | Type | Description |
|---|---|---|
id | string | a stable, non-empty identifier for this deprecation (e.g. |
message | string | the deprecation notice to log. |
- Source
if
idis empty.- Type
- TypeError
fine(loggable)
Logs a message at the Level.FINE log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source
finer(loggable)
Logs a message at the Level.FINER log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source
finest(loggable)
Logs a message at the Level.FINEST log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source
getEffectiveLevel() → (non-null) {Level}
- Source
the effective level for this logger.
- Type:
- Level
getLevel() → {Level}
- Source
the log level for this logger.
- Type:
- Level
getName() → {string}
- Source
the name of this logger.
- Type:
- string
info(loggable)
Logs a message at the Level.INFO log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source
isLoggable(levelnon-null) → {boolean}
| Name | Type | Description |
|---|---|---|
level | Level | the level to check. |
- Source
whether messages recorded at the given level are loggable by this instance.
- Type:
- boolean
log(levelnon-null, loggable)
Logs a message at the given level. The message may be defined as a string or as a function that will return the message. If a function is provided, it will only be invoked if this logger's effective log level includes the given level.
| Name | Type | Description |
|---|---|---|
level | Level | the level at which to log the message. |
loggable | string | | the message to log, or a function that will return the message. |
- Source
removeHandler(handler) → {boolean}
Removes a handler from this logger.
| Name | Type | Description |
|---|---|---|
handler | function | the handler to remove. |
- Source
whether a handler was successfully removed.
- Type:
- boolean
setLevel(level)
| Name | Type | Description |
|---|---|---|
level | Level | the new level for this logger, or |
- Source
severe(loggable)
Logs a message at the Level.SEVERE log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source
warning(loggable)
Logs a message at the Level.WARNING log level.
| Name | Type | Description |
|---|---|---|
loggable | string | | the message to log, or a function that will return the message. |
- Source