@classycrafter/super-logger
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

super-logger


Discord Server npm version npm downloads

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");
Screen1 Screen2

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!

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)!

Package Sidebar

Install

npm i @classycrafter/super-logger

Weekly Downloads

2

Version

2.0.0

License

GNU-GPL-3.0

Unpacked Size

68.9 kB

Total Files

9

Last publish

Collaborators

  • classycrafter