Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Latest commit

 

History

History
48 lines (34 loc) · 1 KB

README.md

File metadata and controls

48 lines (34 loc) · 1 KB

snackdriver

A bite-sized bunyan logger with color, express middleware and a built-in stackdriver stream.

install:

npm install --save snackdriver

example:

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");

Koa request logging middleware

app.use(log.koaMiddleWare());

express request logging middleware

app.use(log.expressMiddleWare());

console output:
alt text

And if your NODE_ENV is set to production it logs to stack driver.

stackdriver output:
alt text