Skip to content
/ logger Public

A lightweight and customizable Logger for Node.js applications.

Notifications You must be signed in to change notification settings

imjxsx/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ @imjxsx/logger (v1.1.1)

A lightweight and customizable logger for Node.js applications

πŸ“₯ Installation


- With NPM

npm install @imjxsx/logger

- With PNPM

pnpm add @imjxsx/logger

- With YARN

yarn add @imjxsx/logger

πŸš€ Example of Use

// index.js
import axios from "axios";
import Logger from "@imjxsx/logger"; // or import { Logger } from "@imjxsx/logger";

let logger = new Logger({
  name: "COLORIZED LOGGER",
  colorize: true,
});
logger.error("An unexpected error occurred");

logger = new Logger({
  name: "JSON LOGGER",
  json: true,
});
logger.info({
  iq: "new:user",
  data: [
    {
      name: "I'm Jxsx",
      email: "imjxsx@github.com",
      password: "*************",
      age: "17",
      country: "PY",
    },
  ],
});

logger = new Logger({
  name: "COLORLESS LOGGER",
  colorize: false,
});
logger.error("An unexpected error occurred");

logger = new Logger({
  name: "HOOK LOGGER",
  async send(log) {
    if (log.level === "ERROR") {
      await axios.post("https://your.domain.com/api/report/error", log);
    }
  },
});
logger.error("Error: This is an error");

Developed with ❀ by imjxsx

About

A lightweight and customizable Logger for Node.js applications.

Resources

Stars

Watchers

Forks