Git Product home page Git Product logo

footprint-node's Introduction

Footprint - Node Logger

A simple and small logger for node.js implemented in ES6 using Winston.

Installation

npm install footprint-node

Usage

Simply require the logger in any file you like:

const Logger = require('footprint-node');

You can now log any message by calling the .log(level, message) method. For example:

Logger.log('info', 'Process started...');

As an alternative to specify the log level as a string the library supports utility methods for all default log levels:

Logger.error('Some message that will be logged with the ERROR level.');
Logger.warn('Some message that will be logged with the WARN level.');
Logger.info('Some message that will be logged with the INFO level.');
Logger.verbose('Some message that will be logged with the VERBOSE level.');
Logger.debug('Some message that will be logged with the DEBUG level.');
Logger.silly('Some message that will be logged with the SILLY level.');

Configuration

The logger is configured using node environment variables.

Log Level

export LOGGER_LEVEL=...

Default: info

Specify the log level the logger should use. This can be set to any of the following values:

  • error (highest priority)
  • warn
  • info
  • verbose
  • debug
  • silly (lowest priority)

The higher the priority the more important the message is considered to be, and the lower the corresponding integer priority.

Handle Exceptions

export LOGGER_HANDLE_EXCEPTIONS=...

Default: true

Determines whether the logger should handle uncaught exceptions or not. If set to true the logger will catch and log any uncaught exceptions.

License

MIT

footprint-node's People

Contributors

benbestmann avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.