@saasquatch/logger
v1.4.2
Published
Thin wrapper around Winston to provide unified logging across SaaSquatch NodeJS services
Downloads
11
Maintainers
Keywords
Readme
The SaaSquatch logging package facilitates unified structured logging across all NodeJS-based SaaSquatch services. It wraps Winston and provides standard log formats for general logging, debugging, and HTTP services.
Getting Started
Install the package from NPM:
npm install @saasquatch/logger
Basic usage:
import { initializeLogger, getLogger } from "@saasquatch/logger";
function main() {
const logger = initializeLogger();
logger.info("Hello");
otherFunction();
}
function otherFunction() {
getLogger()!.info("World!");
}
main();
Express HTTP logging middleware:
import express from "express";
import { httpLogMiddleware, initializeLogger } from "@saasquatch/logger";
const server = express();
const logger = initializeLogger();
server.use(httpLogMiddleware(logger));