@andreas-timm/logger
v0.1.1
Published
Small Bun-first logger wrapper around winston
Downloads
39
Maintainers
Readme
@andreas-timm/logger
Small Bun-first logging utilities built on top of winston.
Features
- Create a configured
winstonlogger with console output. - Add a synchronous file transport by passing an output path.
- Truncate an output file on logger creation with
flag: "w". - Prefix debug messages consistently while keeping the API small.
Install
bun add @andreas-timm/loggerUsage
import { getLogger } from "@andreas-timm/logger";
const logger = getLogger();
logger.info("Application started");
logger.error("File not found");To write log lines to a file as well as the console:
import { getLogger } from "@andreas-timm/logger";
const logger = getLogger({
flag: "w",
output: "tmp/app.log",
});
logger.info("Written to console and file");Pass file: false to keep the same options object shape while disabling file output.
