loganite
v0.1.4
Published
A minimal logger implementation for node, typescript, and the browser
Readme
new Logger( context, level )
This micro-package provides a minimalist logging solution with support for node, typescript, and the browser.
Install
npm i loganiteUsage
Basic
import { Logger } from 'loganite';
const log = new Logger("main", "debug");
log.fatal("Testing");
log.error("Testing");
log.warn("Testing");
log.normal("Testing");
log.info("Testing");
log.debug("Testing");
log.trace("Testing"); // would not logBrowser console control
window.localStorage.setItem("LOG_COLOR", "false"); // turn off coloring
window.localStorage.setItem("LOG_LEVEL", "debug"); // set default level to "debug"Planned features
- Avoid expensive arg computations
- Short-circuit using logical operators
- Callback function for args that only evaluate when a message will be logged
