@emit-js/log
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

@emit-js/log

emit logger

log

Install

npm install @emit-js/emit @emit-js/log

Setup

import { Emit } from "@emit-js/emit"
import { log } from "@emit-js/log"

const emit = new Emit()
log(emit)

Log levels

There are five log levels: trace, debug, info, warn, and error.

By default, the logger only logs messages at log level info or above, but you can change that:

emit.logLevel(null, "debug")

You could also set the environment variable LOG=debug.

Logs all events

By default, the logger logs all events at log level debug.

Change the log level to info for certain events:

emit.logLevel("myEvent", "info")

Manual logging

All of these work:

emit.log(null, "log message at log level info")
emit.log(null, "warn", "warning!")
emit.log(["event", "ids"])

Dependencies (0)

    Dev Dependencies (13)

    Package Sidebar

    Install

    npm i @emit-js/log

    Weekly Downloads

    2

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    13.1 kB

    Total Files

    6

    Last publish

    Collaborators

    • winton