logxx

A simple logger that just work.

Usage no npm install needed!

<script type="module">
  import logxx from 'https://cdn.skypack.dev/logxx';
</script>

README

logxx

Build Status Coverage Status Deps npm npm GitHub license

A simple logger that just work.

Features:

  • no dependency.
  • configurable log levels.
  • configurable appender. such as stdout, file and all writable streams.

Installation

$ npm install logxx -S

Usage

var logxx = require('logxx');

logxx.info('Something');

By default, logxx will output logs to stdout.

Document

  • logxx

    It is a predefined 'standard' Logger accessible through helper functions, which are easier to use than creating a Logger manually.

    property default value
    log level logxx.L_INFO
    output process.stdout
  • log level

    log level description
    logxx.L_SILENCE output nothing
    logxx.L_ERROR output error only
    logxx.L_INFO output both error and info
  • creates a new logger

    Function: logxx.newLogger(level, output)

    The level variable sets the log level.
    value: logxx.L_SILENCE, logxx.L_ERROR, logxx.L_INFO default: logxx.L_INFO

    The output variable sets the destination to which log data will be written.
    type: streams.Writable, default: process.stdout.

  • more functions

    functions description
    logxx.info(anything) output normal message
    logxx.error(anything) output error message
    logxx.getLevel() return log level
    logxx.setLevel(level) set log level
    logxx.getOutput() return output appender
    logxx.setOutput(level) set output appender

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

this repo is released under the MIT License.