skog-core
v1.0.2
Published
**skog-core** are a collection of functions that help you create loggers with context
Downloads
72
Readme
skog-core
skog-core are a collection of functions that help you create loggers with context
Getting started
This is the "example implementation" of the Skog interface. If you are implementing a logging library with Skog, it should behave similar to the following example:
import { skogMiddleware, consoleLog as log } from "skog-core";
import express from "express";
function greet(name) {
log.info(`Hello ${name}`);
}
const app = express();
app.use(skogMiddleware);
app.get("/", (req, res) => {
log.info("Request received");
greet(req.query.name);
res.send(`Hello ${req.query.name}`);
});
app.listen(3000, () => {
log.info("Starting server");
greet("world");
});
Full example with comments here.
Explanation
Example using the "low level" API (for making your own implementation) here
References
- Asynchronous context tracking, Official Node.js documentation