@nathangasc/fox_logger
TypeScript icon, indicating that this package has built-in type declarations

2.0.14 • Public • Published

Fox Logger

Fox logger is a module to do log with namespaces (ex: here the API namespace log -> "[11:23:52] API : GET request on /"). You will be able to disable log for defined namespaces or change log levels for every namespaces to hide error, log, info, debug or warning. You will also be able to format the logs.

This module support typescript (TS).

How to use?

  • Install the module first npm i @nathangasc/fox_logger
  • Copy this script in your code to test the module.
const { createLogger } = require("@nathangasc/fox_logger");
const config = {
  options: {
    format: "[{{h}}:{{m}}:{{s}}] {{namespace}} :",
    isLogged: {
      debug: true,
      log: true,
      error: true,
      warn: true,
      info: true,
    },
  },
  namespaces: {
    default: {
      isLogged: true,
    },
  },
};

const logger = createLogger(config);
logger.default.log("Hello world, here a smart fox log");
  • Run the script, it should output a namespaces log

Readme

Keywords

none

Package Sidebar

Install

npm i @nathangasc/fox_logger

Weekly Downloads

19

Version

2.0.14

License

MIT

Unpacked Size

22.6 kB

Total Files

11

Last publish

Collaborators

  • nathangasc