Nucleic Photon Magnetizer

    @offirmo/practical-logger-core
    TypeScript icon, indicating that this package has built-in type declarations

    3.1.0 • Public • Published

    Offirmo’s practical logger - Core (internal, reusable)
    Offirmo’s quality seal

    npm badge dependencies badge bundle size badge license badge maintenance status badge

    This is an internal / technical component of Offirmo’s practical logger.

    • isomorphic code for node and browser
    • TODO explain the interface pattern

    Usage

    This is most likely not what you are looking for!

    See the final implementations using this module:

    if you know what you are doing:

    While this module was made to be a component in a final logger sink, it is a perfectly working logger which will output JSON lines to stdout, corresponding to log lines, in the same way bunyan does.

    import { createLogger } from '@offirmo/practical-logger-core'
    
    const logger = createLogger({ /* ... */ })
    
    logger.verbose('foo', { bar: 42, baz: 33 })

    Advanced usage:

    import { createLogger, LogPayload } from '@offirmo/practical-logger-core'
    
    function sink(payload: LogPayload) {
        const {
            level,
            name,
            msg,
            time,
            err,
            details
        } = payload
        /* ... */
    }
    
    const logger = createLogger({ /* ... */ }, sink)
    
    logger.verbose('foo', { bar: 42, baz: 33 })

    Install

    npm i @offirmo/practical-logger-core

    DownloadsWeekly Downloads

    23

    Version

    3.1.0

    License

    Unlicense

    Unpacked Size

    75.2 kB

    Total Files

    59

    Last publish

    Collaborators

    • offirmo