Constructor

Log

new Log(logging, name, options)

Parameter

logging

Logging

Logging instance.

name

string

Name of the log.

options

Optional

object

Configuration object.

Values in options have the following properties:

Parameter

removeCircular

Optional

boolean

Replace circular references in logged objects with a string value, [Circular]. (Default: false)

See also

Introduction to Logs

Example

const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const log = logging.log('syslog');

Property

name

string

Method

getEntriesStream

getEntriesStream(query) returns ReadableStream

This method is a wrapper around {module:logging#getEntriesStream}, but with a filter specified to only return {module:logging/entry} objects from this log.

Parameter

query

Optional

GetEntriesRequest

Query object for listing entries.

Returns

ReadableStream 

A readable stream that emits Entry instances.

Example

const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const log = logging.log('my-log');

log.getEntriesStream()
  .on('error', console.error)
  .on('data', entry => {
    // `entry` is a Stackdriver Logging entry object.
    // See the `data` property to read the data from the entry.
  })
  .on('end', function() {
    // All entries retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
log.getEntriesStream()
  .on('data', function(entry) {
    this.end();
  });