Global

Members

v2 :object

Reference to the low-level auto-generated clients for the V2 Logging service.

Properties:
Name Type Description
LoggingServiceV2Client constructor

Reference to v2.LoggingServiceV2Client

ConfigServiceV2Client constructor

Reference to v2.ConfigServiceV2Client

MetricsServiceV2Client constructor

Reference to v2.MetricsServiceV2Client

Methods

decodeValue(value) → {*}

Decode a protobuf Struct's value.

Parameters:
Name Type Description
value object

A Struct's Field message.

(async) detectServiceContext()

For logged errors, users can provide a service context. This enables errors to be picked up Stackdriver Error Reporting. For more information see this guide and the official documentation.

getCloudFunctionDescriptor() → {object}

Create a descriptor for Cloud Functions.

(async) getDefaultResource()

Attempt to contact the metadata service and determine, based on request success and environment variables, what type of resource the library is operating on.

(async) getGAEDescriptor() → {object}

Create a descriptor for Google App Engine.

(async) getGCEDescriptor() → {object}

Create a descriptor for Google Compute Engine.

(async) getGKEDescriptor() → {object}

Create a descriptor for Google Container Engine.

getGlobalDescriptor() → {object}

Create a global descriptor.

makeMiddleware(projectId, makeChildLogger, emitRequestLog)

Generates an express middleware that installs a request-specific logger on the request object. It optionally can do HttpRequest timing that can be used for generating request logs. This can be used to integrate with logging libraries such as winston and bunyan.

Parameters:
Name Type Description
projectId

Generated traceIds will be associated with this project.

makeChildLogger

A function that generates logger instances that will be installed onto req as req.log. The logger should include the trace in each log entry's metadata (associated with the LOGGING_TRACE_KEY property.

emitRequestLog

Optional. A function that will emit a parent request log. While some environments like GAE and GCF emit parent request logs automatically, other environments do not. When provided this function will be called with a populated StackdriverHttpRequest which can be emitted as request log.

Type Definitions

ClientConfig :object

Properties:
Name Type Attributes Default Description
projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option above is not necessary. NOTE: .pem and .p12 require you to specify the email option as well.

email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
autoRetry boolean <optional>
true

Automatically retry requests if the response is related to rate limits or certain intermittent server errors. We will exponentially backoff subsequent requests by default.

maxRetries number <optional>
3

Maximum number of automatic retries attempted before returning the error.

promise Constructor <optional>

Custom promise module to use instead of native Promises.

CreateSinkCallback(errnullable, sink, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

sink Sink

The new Sink.

apiResponse object

The full API response.

CreateSinkRequest :object

Config to set for the sink. Not all available options are listed here, see the Sink resource definition for full details.

Properties:
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.

destination Bucket | Dataset | Topic <optional>

The destination. The proper ACL scopes will be granted to the provided destination. Can be one of: Bucket, Dataset, or Topic

filter string <optional>

An advanced logs filter. Only log entries matching the filter are written.

uniqueWriterIdentity string <optional>

Determines the kind of IAM identity returned as writerIdentity in the new sink. See https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create#query-parameters.

CreateSinkResponse :array

Properties:
Name Type Description
0 Sink

The new Sink.

1 object

The full API response.

DeleteLogCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

DeleteLogResponse :array

Properties:
Name Type Description
0 object

The full API response.

DeleteSinkCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

DeleteSinkResponse :array

Properties:
Name Type Description
0 object

The full API response.

GetEntriesCallback(errnullable, entries, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

entries Array.<Entry>

Array of Entry instances.

apiResponse object

The full API response.

GetEntriesRequest :object

Query object for listing entries.

Properties:
Name Type Attributes Default Description
autoPaginate boolean <optional>
true

Have pagination handled automatically.

filter string <optional>

An advanced logs filter. An empty filter matches all log entries.

gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.

log string <optional>

A name of the log specifying to pnly return entries from this log.

maxApiCalls number <optional>

Maximum number of API calls to make.

maxResults number <optional>

Maximum number of items plus prefixes to return.

orderBy string <optional>

How the results should be sorted, timestamp asc (oldest first) and timestamp desc (newest first, default).

pageSize number <optional>

Maximum number of logs to return.

pageToken string <optional>

A previously-returned page token representing part of the larger set of results to view.

GetEntriesResponse :array

Properties:
Name Type Description
0 Array.<Entry>

Array of Entry instances.

1 object

The full API response.

GetLogsCallback(errnullable, logs, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

logs Array.<Log>

Array of Log instances.

apiResponse object

The full API response.

GetLogsRequest :object

Query object for listing entries.

Properties:
Name Type Attributes Default Description
autoPaginate boolean <optional>
true

Have pagination handled automatically.

gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.

maxApiCalls number <optional>

Maximum number of API calls to make.

maxResults number <optional>

Maximum number of items plus prefixes to return.

pageSize number <optional>

Maximum number of logs to return.

pageToken string <optional>

A previously-returned page token representing part of the larger set of results to view.

GetLogsResponse :array

Properties:
Name Type Description
0 Array.<Log>

Array of Log instances.

1 object

The full API response.

GetSinkMetadataCallback(errnullable, metadata, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

metadata object

The Sink metadata.

apiResponse object

The full API response.

GetSinkMetadataResponse :array

Properties:
Name Type Description
0 object

The Sink metadata.

1 object

The full API response.

GetSinksCallback(errnullable, sinks, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

sinks Array.<Sink>

Array of Sink instances.

apiResponse object

The full API response.

GetSinksRequest :object

Query object for listing sinks.

Properties:
Name Type Attributes Default Description
autoPaginate boolean <optional>
true

Have pagination handled automatically.

gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.

maxApiCalls number <optional>

Maximum number of API calls to make.

maxResults number <optional>

Maximum number of items plus prefixes to return.

pageSize number <optional>

Maximum number of logs to return.

pageToken string <optional>

A previously-returned page token representing part of the larger set of results to view.

GetSinksResponse :array

Properties:
Name Type Description
0 Array.<Sink>

Array of Sink instances.

1 object

The full API response.

LogWriteCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

LogWriteResponse :array

Properties:
Name Type Description
0 object

The full API response.

SetSinkFilterCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

SetSinkFilterResponse :array

Properties:
Name Type Description
0 object

The full API response.

SetSinkMetadataCallback(errnullable, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

apiResponse object

The full API response.

SetSinkMetadataResponse :array

Properties:
Name Type Description
0 object

The full API response.

WriteOptions :object

Write options.

Properties:
Name Type Attributes Description
dryRun boolean <optional>

If true, the request should expect normal response, but the entries won't be persisted nor exported.

gaxOptions object

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.

labels Array.<object>

Labels to set on the log.

partialSuccess boolean <optional>

Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors.

resource object

A default monitored resource for entries where one isn't specified.