Class LoggingBunyan (3.0.2)

This module provides support for streaming your Bunyan logs to [Stackdriver Logging](https://cloud.google.com/logging).

Inheritance

Writable > LoggingBunyan

Package

@google-cloud/logging-bunyan!

Constructors

(constructor)(options)

constructor(options?: types.Options);

Constructs a new instance of the LoggingBunyan class

Parameter
NameDescription
options types.Options

Properties

stackdriverLog

stackdriverLog: types.StackdriverLog;
Property Value
TypeDescription
types.StackdriverLog

Methods

_write(record, encoding, callback)

_write(record: types.BunyanLogRecord, encoding: string, callback: Function): void;

Relay a log entry to the logging agent. This is called by bunyan through Writable#write.

Parameters
NameDescription
record types.BunyanLogRecord
encoding string
callback Function
Returns
TypeDescription
void

_writev(chunks, callback)

_writev(chunks: Array<{
        chunk: any;
        encoding: string;
    }>, callback: Function): void;

Relay an array of log entries to the logging agent. This is called by bunyan through Writable#write.

Parameters
NameDescription
chunks Array<{ chunk: any; encoding: string; }>
callback Function
Returns
TypeDescription
void

properLabels(labels)

static properLabels(labels: any): boolean;
Parameter
NameDescription
labels any
Returns
TypeDescription
boolean

stream(level)

stream(level: types.LogLevel): types.StreamResponse;

Convenience method that Builds a bunyan stream object that you can put in the bunyan streams list.

Parameter
NameDescription
level types.LogLevel
Returns
TypeDescription
types.StreamResponse

write(record, callback)

write(record: types.BunyanLogRecord, callback?: Function): boolean;

Intercept log entries as they are written so we can attempt to add the trace ID in the same continuation as the function that wrote the log, because the trace agent currently uses continuation local storage for the trace context.

By the time the Writable stream buffer gets flushed and _write gets called we may well be in a different continuation.

Parameters
NameDescription
record types.BunyanLogRecord
callback Function
Returns
TypeDescription
boolean

write(record, encoding, callback)

write(record: types.BunyanLogRecord, encoding?: string, callback?: Function): boolean;
Parameters
NameDescription
record types.BunyanLogRecord
encoding string
callback Function
Returns
TypeDescription
boolean