Send feedback
Class Log (9.3.1) Stay organized with collections
Save and categorize content based on your preferences.
Version 9.3.1 keyboard_arrow_down
A log is a named collection of entries, each entry representing a timestamped event. Logs can be produced by Google Cloud Platform services, by third-party services, or by your applications. For example, the log apache-access
is produced by the Apache Web Server, but the log compute.googleapis.com/activity_log
is produced by Google Compute Engine.
[Introduction to Logs] https://cloud.google.com/logging/docs/basic-concepts#logs
Package
@google-cloud/logging!
Constructors
(constructor)(logging, name, options)
constructor
(
logging
:
Logging
,
name
:
string
,
options
?:
LogOptions
);
Constructs a new instance of the Log
class
Parameters
Properties
formattedName_
:
string
;
Property Value
logging
Property Value
maxEntrySize
Property Value
name
Property Value
removeCircular_
removeCircular_
:
boolean
;
Property Value
Methods
alert(entry, options)
alert
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
alert(entry, options, callback)
alert
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
alert(entry, callback)
alert
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
assignSeverityToEntries_(entries, severity)
static
assignSeverityToEntries_
(
entries
:
Entry
|
Entry
[],
severity
:
string
)
:
Entry
[];
Return an array of log entries with the desired severity assigned.
Parameters Name
Description
entries
Entry
| Entry
[]
Log entries.
severity
string
The desired severity level.
Returns
critical(entry, options)
critical
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
critical(entry, options, callback)
critical
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
critical(entry, callback)
critical
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
debug(entry, options)
debug
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
debug(entry, options, callback)
debug
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
debug(entry, callback)
debug
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
delete(gaxOptions)
delete
(
gaxOptions
?:
CallOptions
)
:
Promise<ApiResponse>
;
Parameter
Returns
delete(gaxOptions, callback)
delete
(
gaxOptions
:
CallOptions
,
callback
:
DeleteCallback
)
:
void
;
Parameters
Returns
delete(callback)
delete
(
callback
:
DeleteCallback
)
:
void
;
Parameter
Returns
emergency(entry, options, callback)
emergency
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
emergency(entry, callback)
emergency
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
entry(metadata)
entry
(
metadata
?:
LogEntry
)
:
Entry
;
Parameter
Returns
entry(data)
entry
(
data
?:
string
|
{})
:
Entry
;
Parameter Name
Description
data
string | {}
Returns
entry(metadata, data)
entry
(
metadata
?:
LogEntry
,
data
?:
string
|
{})
:
Entry
;
Parameters Name
Description
metadata
LogEntry
data
string | {}
Returns
error(entry, options)
error
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
error(entry, options, callback)
error
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
error(entry, callback)
error
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
static
formatName_
(
projectId
:
string
,
name
:
string
)
:
string
;
Format the name of a log. A log's full name is in the format of 'projects/{projectId}/logs/{logName}'.
Parameters
Returns
getEntries(options)
getEntries
(
options
?:
GetEntriesRequest
)
:
Promise<GetEntriesResponse>
;
Parameter
Returns
getEntries(callback)
getEntries
(
callback
:
GetEntriesCallback
)
:
void
;
Parameter
Returns
getEntries(options, callback)
getEntries
(
options
:
GetEntriesRequest
,
callback
:
GetEntriesCallback
)
:
void
;
Parameters
Returns
getEntriesStream(options)
getEntriesStream
(
options
:
GetEntriesRequest
)
:
import
(
"stream"
).
Duplex
;
This method is a wrapper around {module:logging#getEntriesStream}, but with a filter specified to only return {module:logging/entry} objects from this log.
Log#getEntriesStream
Parameter
Returns Type
Description
import("stream"). internal.Duplex
{ReadableStream} A readable stream that emits Entry
instances.
info(entry, options)
info
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
info(entry, options, callback)
info
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
info(entry, callback)
info
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
notice(entry, options)
notice
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
notice(entry, options, callback)
notice
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
notice(entry, callback)
notice
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
tailEntries(options)
tailEntries
(
options
?:
TailEntriesRequest
)
:
import
(
"stream"
).
Duplex
;
This method is a wrapper around {module:logging#tailEntries}, but with a filter specified to only return {module:logging/entry} objects from this log.
Log#tailEntries
Parameter
Returns Type
Description
import("stream"). internal.Duplex
{DuplexStream} A duplex stream that emits TailEntriesResponses containing an array of Entry
instances.
warning(entry, options)
warning
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
warning(entry, options, callback)
warning
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
warning(entry, callback)
warning
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
write(entry, options)
write
(
entry
:
Entry
|
Entry
[],
options
?:
WriteOptions
)
:
Promise<ApiResponse>
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
Returns
write(entry, options, callback)
write
(
entry
:
Entry
|
Entry
[],
options
:
WriteOptions
,
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
options
WriteOptions
callback
ApiResponseCallback
Returns
write(entry, callback)
write
(
entry
:
Entry
|
Entry
[],
callback
:
ApiResponseCallback
)
:
void
;
Parameters Name
Description
entry
Entry
| Entry
[]
callback
ApiResponseCallback
Returns
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,[]]