stackdriver-logging-node v3.1.4
Simplified stackdriver stream creation with bunyan & logging-bunyan packages
Stackdriver logging node
Install
npm install --save stackdriver-logging-node
Instructions
Stackdriver logging node will automatically create stackdriver stream with package @google-cloud/logging-bunyan.
If you want to disable stackdriver stream, pass option property streamToCloud as false.
Options
Stackdriver logging node takes two parameter in initialization. After initialization, package can be required without parameters or with only single parameter (route).
route Parameter to indicate where log is send.
options Options object for google-bunyan package
options.logName Name of the application. REQUIRED.
options.level Log level. Default value is info.
options.streamToCloud Log cloud streaming mode.
Default value is true.
On local use, it's recommended to set this value as false.
Example
Initialization
// Example options, use config in real deal
const options = {
logName: 'example-application', // Required
level: 'warn', // Optional
streamToCloud: true // Optional
};
const logger = require('stackdriver-logging-node')(__filename, options);Parameter options require property logName or environment variable APPLICATION_NAME.
After initalization
Initialization has to be run atleast once before using package like this.
// Can be run without params
const logger = require('stackdriver-logging-node')();
// Or with file trace
const logger = require('stackdriver-logging-node')(__filename);
// Or custom path
const logger = require('stackdriver-logging-node')('/path/to/url');3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago