Nosy Pinocchio Manners

    @isfe/logger

    0.1.1 • Public • Published

    @isfe/logger

    Author

    @bqliu

    @isfe

    Purpose

    We always need to log something. Sometimes in local console, sometimes post some message to backend server.

    And several teamates has created some logger util, but when use, they always mix each other.

    So, I create this library to unify it.

    This library is simple but customizable.

    Usage

    Install

    $ npm i -S @isfe/logger

    Simple usage

    const logger = require('@isfe/logger')
    
    ;[ 'DEBUG', 'INFO', 'WARN', 'ERROR' ].forEach(levelName => logger[levelName]('module', 'content'))

    Customize example

    const logger = require('@isfe/logger')
    
    const logFn = function (time, level, module, content) {
      (new Image()).src = `http://example.com/log?${content}`
    }
    
    logger.addCoreLogger('toBackEnd', logFn)
    
    const toBackEnd = logger.getCoreLogger('toBackEnd')
    
    toBackEnd.DEBUG('module', 'content')

    Note

    This lib is very simple, but it is enough for common usage now.

    Of course, we are looking for better idea.

    Keywords

    Install

    npm i @isfe/logger

    DownloadsWeekly Downloads

    0

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    20 kB

    Total Files

    14

    Last publish

    Collaborators

    • hxli
    • bqliu