LoggingBunyan
Source: index.
This module provides support for streaming your Bunyan logs to Stackdriver Logging.
Property
Methods
new LoggingBunyan([options])
Examples
Import the client library
const {LoggingBunyan} = require('@google-cloud/logging-bunyan');
<caption>Create a client that uses <a
href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application
Default Credentials (ADC)</a>:</caption> const loggingBunyan = new
LoggingBunyan();
<caption>Create a client with <a
href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit
credentials</a>:</caption> const loggingBunyan = new LoggingBunyan({
projectId: 'your-project-id',
keyFilename: '/path/to/keyfile.json'
});
include:samples/quickstart.js
region_tag:logging_bunyan_quickstart
Full quickstart example:
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
options |
|
Yes |
Values in
|
Property
LOGGING_TRACE_KEY string
Value: logging.googleapis.com/trace
Methods
_write()
Relay a log entry to the logging agent. This is called by bunyan through Writable#write.
_writev()
Relay an array of log entries to the logging agent. This is called by bunyan through Writable#write.
formatEntry_()
Format a bunyan record into a Stackdriver log entry.
stream()
Convenience method that Builds a bunyan stream object that you can put in the bunyan streams list.