Send feedback
Class Logging (9.5.7) Stay organized with collections
Save and categorize content based on your preferences.
Version 9.5.7 keyboard_arrow_down
Package
@google-cloud/logging!
Constructors
(constructor)(options)
constructor
(
options
?:
LoggingOptions
);
Constructs a new instance of the Logging
class
Parameter
Properties
api
api
:
{
[
key
:
string
]
:
gax
.
ClientStub
;
};
Property Value
auth
auth
:
gax
.
GoogleAuth
;
Property Value
configService
configService
?:
typeof
v2
.
ConfigServiceV2Client
;
Property Value
detectedResource
detectedResource
?:
object
;
Property Value
loggingService
loggingService
?:
typeof
v2
.
LoggingServiceV2Client
;
Property Value
options
options
:
LoggingOptions
;
Property Value
projectId
Property Value
Methods
createSink(name, config)
createSink
(
name
:
string
,
config
:
CreateSinkRequest
)
:
Promise
< [
Sink
,
LogSink
]>;
Parameters
Returns
createSink(name, config, callback)
createSink
(
name
:
string
,
config
:
CreateSinkRequest
,
callback
:
CreateSinkCallback
)
:
void
;
Parameters
Returns
entry(resource, data)
entry
(
resource
?:
LogEntry
,
data
?:
{}
|
string
)
:
Entry
;
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
)
:
Duplex
;
List the Entry
objects in your logs as a readable object stream.
Logging#getEntriesStream
Parameter
Returns Type
Description
Duplex
{ReadableStream} A readable stream that emits Entry
instances.
getLogs(options)
getLogs
(
options
?:
GetLogsRequest
)
:
Promise<GetLogsResponse>
;
Parameter
Returns
getLogs(callback)
getLogs
(
callback
:
GetLogsCallback
)
:
void
;
Parameter
Returns
getLogs(options, callback)
getLogs
(
options
:
GetLogsRequest
,
callback
:
GetLogsCallback
)
:
void
;
Parameters
Returns
getLogsStream(options)
getLogsStream
(
options
?:
GetLogsRequest
)
:
Duplex
;
List the Log
objects in your project as a readable object stream.
Logging#getLogsStream
Parameter
Returns Type
Description
Duplex
{ReadableStream} A readable stream that emits Log
instances.
getSinks(options)
getSinks
(
options
?:
GetSinksRequest
)
:
Promise<GetSinksResponse>
;
Parameter
Returns
getSinks(callback)
getSinks
(
callback
:
GetSinksCallback
)
:
void
;
Parameter
Returns
getSinks(options, callback)
getSinks
(
options
:
GetSinksRequest
,
callback
:
GetSinksCallback
)
:
void
;
Parameters
Returns
getSinksStream(options)
getSinksStream
(
options
:
GetSinksRequest
)
:
Duplex
;
Get the Sink
objects associated with this project as a readable object stream.
Logging#getSinksStream
Parameter
Returns Type
Description
Duplex
{ReadableStream} A readable stream that emits Sink
instances.
log(name, options)
log
(
name
:
string
,
options
?:
LogOptions
)
:
Log
;
Parameters Name
Description
name
string
Name of the existing log.
options
LogOptions
Configuration object.
Returns
logSync(name, transport)
logSync
(
name
:
string
,
transport
?:
Writable
)
:
LogSync
;
Get a reference to a Cloud Logging logSync.
Parameters Name
Description
name
string
Name of the existing log.
transport
Writable
An optional write stream.
Returns
request(config, callback)
request<TResponse
=
any
> (
config
:
RequestConfig
,
callback
?:
RequestCallback<TResponse>
)
:
Duplex
;
Funnel all API requests through this method, to be sure we have a project ID.
Parameters
Returns
Type Parameter
setAclForBucket_(config)
setAclForBucket_
(
config
:
CreateSinkRequest
)
:
Promise<void>
;
This method is called when creating a sink with a Bucket destination. The bucket must first grant proper ACL access to the Cloud Logging account.
The parameters are the same as what accepts.
Parameter
Returns
setAclForDataset_(config)
setAclForDataset_
(
config
:
CreateSinkRequest
)
:
Promise<void>
;
This method is called when creating a sink with a Dataset destination. The dataset must first grant proper ACL access to the Cloud Logging account.
The parameters are the same as what accepts.
Parameter
Returns
setAclForTopic_(config)
setAclForTopic_
(
config
:
CreateSinkRequest
)
:
Promise<void>
;
This method is called when creating a sink with a Topic destination. The topic must first grant proper ACL access to the Cloud Logging account.
The parameters are the same as what accepts.
Parameter
Returns
setDetectedResource()
setDetectedResource
()
:
Promise<void>
;
setResource detects and sets a detectedresource object on the Logging instance. It can be invoked once to ensure ensuing LogSync entries contain resource context.
Returns
setProjectId(reqOpts)
setProjectId
(
reqOpts
?:
{})
:
Promise<void>
;
setProjectId detects and sets a projectId string on the Logging instance. It can be invoked once to ensure ensuing LogSync entries have a projectID.
Parameter
Returns
sink(name)
sink
(
name
:
string
)
:
Sink
;
Parameter Name
Description
name
string
Name of the existing sink.
Returns
tailEntries(options)
tailEntries
(
options
?:
TailEntriesRequest
)
:
Duplex
;
Streaming read of live logs as log entries are ingested. Until the stream is terminated, it will continue reading logs.
Logging#tailEntries
Parameter
Returns Type
Description
Duplex
{DuplexStream} A duplex stream that emits TailEntriesResponses containing an array of Entry
instances.
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,[]]