A bite-sized bunyan logger with color, express middleware and a built-in stackdriver stream.
npm install --save snackdriver
const Logger = require("snackdriver");
const log = new Logger({
logName: "test",
logStreams: [
{ env: "development", stream: "bunyanDebugStream" },
{ env: "development", stream: "stdout" },
{ env: "production", stream: "stackdriver" }
],
logLevel: "info"
});
log.info("hello world");
log.warn("oh no world");
log.error("ruh roh world");
app.use(log.koaMiddleWare());
app.use(log.expressMiddleWare());
And if your NODE_ENV
is set to production
it logs to stack driver.