Globals
Property
Methods
Abstract type
Property
v2 object
Reference to the low-level auto-generated clients for the V2 Logging service.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
LoggingServiceV2Client |
constructor |
|
Reference to v2.LoggingServiceV2Client |
|
ConfigServiceV2Client |
constructor |
|
Reference to v2.ConfigServiceV2Client |
|
MetricsServiceV2Client |
constructor |
|
Reference to v2.MetricsServiceV2Client |
Methods
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.
- Returns
-
object
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.
getGAEDescriptor() → object
Create a descriptor for Google App Engine.
- Returns
-
object
getGCEDescriptor() → object
Create a descriptor for Google Compute Engine.
- Returns
-
object
getGKEDescriptor() → object
Create a descriptor for Google Container Engine.
- Returns
-
object
getGlobalDescriptor() → object
Create a global descriptor.
- Returns
-
object
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 | Optional | Description |
|---|---|---|---|
|
projectId |
|
|
Generated traceIds will be associated with this project. |
|
makeChildLogger |
|
|
A function that generates logger instances that will
be installed onto |
|
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 |
Abstract type
ClientConfig object
Properties
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
projectId |
string |
Yes |
The project ID from the Google Developer's
Console, e.g. 'grape-spaceship-123'. We will also check the environment
variable |
||||||||||||
|
keyFilename |
string |
Yes |
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 |
||||||||||||
|
|
string |
Yes |
Account email address. Required when using a .pem or .p12 keyFilename. |
||||||||||||
|
credentials |
object |
Yes |
Credentials object. Values in
|
||||||||||||
|
autoRetry |
boolean |
Yes |
Automatically retry requests if the response is related to rate limits or certain intermittent server errors. We will exponentially backoff subsequent requests by default. Defaults to |
||||||||||||
|
maxRetries |
number |
Yes |
Maximum number of automatic retries attempted before returning the error. Defaults to |
||||||||||||
|
promise |
Constructor |
Yes |
Custom promise module to use instead of native Promises. |