0.0.2 • Published 3 years ago

mobiotics-logger v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Install


    npm i mobiotics-logger

Usage


    import('mobiotics-logger'); //assigns global Logger Instance.

    Logger.log('Log this message to console.'); 

Importing the library exposes Global Logger Instance to be used anywhere in your codebase.

Logger has different levels which can be accessed using Logger.levels :

Logger.table(Logger.levels)
ON0
WARN40
ERROR70
OFF100

Logger is initially set to ON which logs everything. You can however change levels using:

    Logger.setLevel( Logger.levels.OFF);
    Logger.log('nothing is logged');

Modules


Logger modules can be created which makes it easy to identify different logs.

    const appLogger=Logger.get('App');
    appLogger.log('call from app level');
    //APP:  call from app level

Logger modules can be set with their own custom level.

By default Logger modules gets assigned the level active in root Logger.

Logger.get() internally creates instances which are identified by the name passed ensuring that duplicate instances are not created.


0.0.2

3 years ago

0.0.1

3 years ago