Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

egomobile/js-log

Repository files navigation

npm last build PRs Welcome

@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.