2.0.0 • Published 1 year ago

@classycrafter/super-logger v2.0.0

Weekly downloads
-
License
GNU-GPL-3.0
Repository
github
Last release
1 year ago

A super customisable and advanced logger.

Utilisation & Examples

To install it, run the following command:

npm i @classycrafter/super-logger

Code Example

const superlogger = require('@classycrafter/super-logger');

const myLogger = new superlogger.Logger({
    name: "Example",
    timezone: "Europe/Paris",
    tzformat: 24,
    dirpath: "./logstest",
    writelogs: true,
    colored: true,
    custom: {
        character: "*",
        gray: "#bbbbbb",
        namecolor: "#ff0000",
        processcolor: "#ff6400",
        titlecolor: "#00ff78",
        textcolor: "#00ff8f",
        datecolor: "#00a6ff"
    }
});


// Examples
myLogger.info("This is an info example", "OptionalProcess");
myLogger.warn("This is a warn example", "OptionalProcess");
myLogger.error("This is an error example", "OptionalProcess");
myLogger.debug("This is a debug example", "OptionalProcess");
myLogger.custom("This is a custom example", "CustomTitle", "OptionalProcess");
myLogger.fatal("This is a fatal example", "OptionalProcess");

Remark You can alse customise the whole logger colors with the "colors" property in the logger options.

const superlogger = require('@classycrafter/super-logger');

const myLogger = new superlogger.Logger({ name: "Example", timezone: "Europe/Paris", tzformat: 24, dirpath: "./logstest", writelogs: true, colored: true, colors: { grey: '#bbbbbb', gray: '#4C4C4C', blue: '#48ACF8', loggernamecolor: '#4CBAFF', processcolor: '#4C70FF', info: { color: '#59E77D', dark: '#11cc37', background: '#D2EED9', highlight: false, }, debug: { color: '#68E3DF', dark: '#13aba4', background: '#D5F5F4', highlight: false, }, warn: { color: '#F2D349', dark: '#c9a81b', background: '#FAEFBB', highlight: false, }, error: { color: '#F6545C', dark: '#dc222c', background: '#FACBCD', highlight: false, }, fatal : { color: '#F71111', dark: '#9b0000', background: '#FAACAC', highlight: true, } } });

**Added support for typescript!**
```ts
import * as superlogger from '@classycrafter/super-logger';

const myLogger = new superlogger.Logger({
    name: "Example",
    timezone: "Europe/Paris",
    tzformat: 24,
    dirpath: "./logstest",
    writelogs: true,
    colored: true,
    custom: {
        character: "*",
        gray: "#bbbbbb",
        namecolor: "#ff0000",
        processcolor: "#ff6400",
        titlecolor: "#00ff78",
        textcolor: "#00ff8f",
        datecolor: "#00a6ff"
    }
});

What's new?

In version 1.1.32 we fixed a big bug with the writeLogs and all things related to files. Please download latest release for a better experience. In version 1.1.33 we just added those What's New things. In version 1.4.34 we changed the way to stock logs. Now it's in multiple files ! In 1.4.35 we added that to the readme since we forgot...

New Version 2.0.00 -- Changed:

  • The logfile names for a better look
  • Added support for typescript (remake of the whole package from 0)
  • Optimised the package
  • Added a new property in the logger options: "colors" (possibility to customise the whole logger colors)
  • Added "debug" function
  • Added "fatal" function (which is the same as "error" but with a different color & exits the process)

Additional Information

This package is under GNU GPL 3.0. Use the package as your wishes. WE AREN'T RESPONSIBLE FOR WHAT YOU DO WITH THE PACKAGE! You found a bug? Report it on the GitHub or send me an email (contact@classy.works)! Any suggestions? Send them on the GitHub by opening an Issue or send me an email (contact@classy.works)!