5.3.3 • Published 11 months ago

logestige v5.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Logestige

Logestige is a customizable logging utility for JavaScript applications. It allows you to log messages at different levels and selectively turn logging on or off for specific levels.

Installation

Logestige can be installed via npm or yarn:

npm install logestige

or

yarn add logestige

Usage

import { Logestige } from "logestige";

const logger = new Logestige();

logger.log("info", "Hello, world!"); // logs "Hello, world!" at the "info" level

You can also use the convenience methods error(), warn(), info(), and debug():

logger.error("Something went wrong"); // logs "Something went wrong" at the "error" level

You can also override the default console methods by calling overrideConsole(). This will replace the default console methods with the corresponding Logestige methods:

const logger = new Logestige();

logger.overrideConsole(); // replaces default console methods with Logestige methods

console.log("info", "This will be logged by Logestige"); // this will be logged by Logestige with the level of "info".

Log Levels

By default, all log levels are enabled. You can selectively turn logging on or off for specific levels by calling on() or off() with the appropriate level(s). For example to turn off the "debug" level:

logger.off("debug"); // turns off logging for the "debug" level

logger.debug("This won't be logged"); // this won't be logged because "debug" logging is turned off

To turn on the "debug" level:

logger.on("debug"); // turns logging back on for the "debug" level

logger.debug("This will be logged now");

The available logging levels are:

  • error
  • warn
  • info
  • debug

You can log messages at a specific level by calling the corresponding method:

logger.error("Something went wrong");
logger.warn("This could be a problem");
logger.info("Just an FYI");
logger.debug("Debugging information");

You can turn all logging levels on or off by calling onAll() or offAll()

5.3.3

11 months ago

5.3.2

11 months ago

5.3.1

11 months ago

5.3.0

12 months ago

5.2.0

12 months ago

5.1.5

12 months ago

5.1.4

12 months ago

5.1.3

12 months ago

5.1.2

12 months ago

5.1.1

12 months ago

5.1.0

12 months ago

5.0.4

12 months ago

5.0.3

12 months ago

5.0.2

12 months ago