@egomobile/log
v0.3.0
Published
Logger framework written for JavaScript.
Downloads
8
Readme
@egomobile/log
A logging framework written for JavaScript and in TypeScript.
Install
Execute the following command from your project folder, where your package.json
file is stored:
npm install --save @egomobile/log
Usage
import log, { LogType } from "@egomobile/log";
// filter: no debug or trace
log.filter((type: LogType, args: any[]) => type <= LogType.Info);
// add one or more custom middlewares
log.use((type: LogType, args: any[]) => {
// your code
});
// 'log' uses console by default
log("foo"); // default: debug
log.debug("foo"); // debug
log.error("foo"); // error
log.warn("foo"); // warning
log.info("foo"); // information
log.trace("foo"); // trace
Documentation
The API documentation can be found here.