logger namespace

Functions

FunctionDescription
debug(args)Writes aDEBUG severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.
error(args)Writes anERROR severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.
info(args)Writes anINFO severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.
log(args)Writes anINFO severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.
warn(args)Writes aWARNING severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.
write(entry)Writes aLogEntry tostdout/stderr (depending on severity).

Interfaces

InterfaceDescription
LogEntryLogEntry represents a [structured Cloud Logging](https://cloud.google.com/logging/docs/structured-logging) entry. All keys aside fromseverity andmessage are included in thejsonPayload of the logged entry.

Variables

VariableDescription
loggerLogger object containing all logging methods.Mockable for testing purposes.

Type Aliases

Type AliasDescription
LogSeverityLogSeverity indicates the detailed severity of the log entry. See [LogSeverity](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity).

logger.debug()

Writes aDEBUG severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.

Signature:

exportdeclarefunctiondebug(...args:any[]):void;

Parameters

ParameterTypeDescription
argsany[]Arguments, concatenated into the log message with space separators.

Returns:

void

logger.error()

Writes anERROR severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.

Signature:

exportdeclarefunctionerror(...args:any[]):void;

Parameters

ParameterTypeDescription
argsany[]Arguments, concatenated into the log message with space separators.

Returns:

void

logger.info()

Writes anINFO severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.

Signature:

exportdeclarefunctioninfo(...args:any[]):void;

Parameters

ParameterTypeDescription
argsany[]Arguments, concatenated into the log message with space separators.

Returns:

void

logger.log()

Writes anINFO severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.

Signature:

exportdeclarefunctionlog(...args:any[]):void;

Parameters

ParameterTypeDescription
argsany[]Arguments, concatenated into the log message with space separators.

Returns:

void

logger.warn()

Writes aWARNING severity log. If the last argument provided is a plain object, it is added to thejsonPayload in the Cloud Logging entry.

Signature:

exportdeclarefunctionwarn(...args:any[]):void;

Parameters

ParameterTypeDescription
argsany[]Arguments, concatenated into the log message with space separators.

Returns:

void

logger.write()

Writes aLogEntry tostdout/stderr (depending on severity).

Signature:

exportdeclarefunctionwrite(entry:LogEntry):void;

Parameters

ParameterTypeDescription
entryLogEntryTheLogEntry including severity, message, and any additional structured metadata.

Returns:

void

logger.logger

Logger object containing all logging methods.

Mockable for testing purposes.

Signature:

logger:{write:typeofwrite;debug:typeofdebug;log:typeoflog;info:typeofinfo;warn:typeofwarn;error:typeoferror;}

logger.LogSeverity

LogSeverity indicates the detailed severity of the log entry. See [LogSeverity](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity).

Signature:

exporttypeLogSeverity="DEBUG"|"INFO"|"NOTICE"|"WARNING"|"ERROR"|"CRITICAL"|"ALERT"|"EMERGENCY";

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-11-10 UTC.