1.1.3 • Published 10 months ago

@yassinrouis/logger v1.1.3

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

favorite version

Logger (Baby's Update - v1.0)

Table of contents

Introduction

logger is a colorful logger for organizing your messages, and easily returning to them !

Imgur

Documentation

Install

1) Download from NPM :

npm i @yassinrouis/logger

2) Loading and initialization:

const Logger = require("@yassin-rouis/logger");

let log = new Logger(); // Simple constructor

// or
let log = new Logger({
  level: Logger.DEBUG, // Change the logging level
  clear: true          // Clear the console when an instance is created
})

Usage

There are 6 levels of loggings :

  • Developpement :
    • verbose (10)
    • debug (20)
    • log (30)
  • Display :
    • info (40)
    • success (35)
  • Problems and errors :
    • warn (50)
    • error (60)
    • fatal (70)

Each level can be used as follows :

// log.<level>("Your", "message", "on", "multiple \n lines")
// example :

log.log("We are", 7, "in the room !")
log.error("Can't find the eggs !")

Methods

<Logger> is any instance of Logger.

Logging methods

  • <Logger>.verbose(...<objects or string>)
  • <Logger>.debug(...<objects or string>)
  • <Logger>.log(...<objects or string>)
  • <Logger>.info(...<objects or string>)
  • <Logger>.success(...<objects or string>)
  • <Logger>.warn(...<objects or string>)
  • <Logger>.error(...<objects or string>)
  • <Logger>.fatal(...<objects or string>)
  • <Logger>.clear()

    Clear node's console (print \x1Bc)

Settings

  • <Logger>.setLevel(<level | int>)

    Set logging level. Can be a level like ... :

    Logger.VERBOSE, Logger.DEBUG, Logger.LOG, etc ...

  • <Logger>.getLevel() : int

Coming soon

  • Colorful Logger
  • Logging level
  • Objects logging
  • NPM package
  • Print to file
  • Print to write stream
1.1.3

10 months ago

1.1.1

12 months ago

1.0.2

1 year ago

1.1.0

12 months ago

1.0.1

1 year ago

1.1.2

12 months ago

1.0.3

1 year ago

0.2.1

1 year ago

0.1.4

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago