2.0.0 • Published 4 years ago

@fluidt/logger v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

fluid.logger for Node.js: a simple logger for your application

🦒 Simple Logger for Node.js

The best alternative to the console.log statement

🎁 Support:

This project is free, open source and I try to provide excellent free support.

📎 Menu

💡 Features

  • ✔️ Easy to use
  • ✔️ MIT License
  • ✔️ Palette (🎨 Customize colors)
  • ✔️ The best alternative to the console.log statement

🚀 Installation

  1. In your node project run: npm install @fluidt/logger --save
  2. Usage:
const logger = require("@fluidt/logger");
logger.info("message");

You can set envs to control logging level export LOG_LEVEL=DEBUG example (logtest.js):

const logger = require("@fluidt/logger");

logger.info("This is an informational");
logger.error("This is an error")

Run:
LOG_LEVEL=ERROR node logtest.js

See folder tests, run with node run test. Below is available a description of envs values.

🧰 Options

ParameterDescriptionValuesDefault valueAvailable since
LOG_LEVELSets Log LevelERROR, WARN, INFO, DEBUGDEBUGv1.0.0
LOG_COLOR_INFOSet INFO Level colorSee Color List belowgreenv2.0.0
LOG_COLOR_DEBUGSet DEBUG Level colorSee Color List belowbluev2.0.0
LOG_COLOR_ERRORSet ERROR Level colorSee Color List belowredv2.0.0
LOG_COLOR_WARNSet WARN Level colorSee Color List belowyellowv2.0.0

Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • blackBright (alias: gray, grey)
  • redBright
  • greenBright
  • yellowBright
  • blueBright
  • magentaBright
  • cyanBright
  • whiteBright

🔌 Methods

MethodDescriptionParameters
debug(message)message: Display debug log messagemessage: string (mandatory)
info(message)message: Display info log messagemessage: string (mandatory)
warn(message)message: Display warning log messagemessage: string (mandatory)
error(message)message: Display errors log messagemessage: string (mandatory)
log(message)message: Display log messagemessage: string (mandatory)
setLogLevel(level)level: Loglevel for Displaylevel: string (optional)
setColors(color)color: colors for each LogLevellevel: object (optional)

💫 License

  • Code and Contributions have MIT License
Copyright (c) 2021 Dan Abarbanel [contact@fluidt.dev](mailto:contact@fluidt.dev)

Change Log

  • v2.0
    • Switched to use Javascript class syntax
    • Fixed Bug where envs were not being passed as part of the config
    • Added support for user defined colors
    • Deprecated the init function, setLogLevel should be used in its place
  • v1.0
    • Initial Logger Implementation
2.0.0

4 years ago

1.0.0

5 years ago