Giter VIP home page Giter VIP logo

davlog's Introduction

davlog

This is the logger that I use in my CLI tools.

usage

var davlog = require('davlog');

var logger = davlog.init({
    name: 'foo',
    color: 'white'
}); //Should only need once

logger.info('This is a test');

foo [info] This is test

Note that the module is an instance of itself, with the default options:

var davlog = require('davlog');

davlog.info('This is a test');

davlog [info] This is test

methods

  • info
  • log
  • warn
  • err
  • error Will process.exit(1) when called.
  • silent Disable all output
  • quiet Disable all but log and info

options

The init function allows for 3 options:

  • name - The name prefix to the string: Defaults to: 'davlog'
  • color - The string for the color or false to disable color: Defaults to magenta
  • timestamps - If true, adds an ISO timestamp to the beginning of each log line.
  • stdout - A writeable stream for normal log messages: Defaults to process.stdout
  • stderr - A writeable stream for error log messages: Defaults to process.stderr

You can override all prefixes by using the: logger.STRINGS object. You can override all default colors by using the logger.COLORS object.

There are also stdout and stderr properties on the object, which are readable streams. These are useful for piping log data elsewhere.

build status

Build Status

node badge

NPM

davlog's People

Contributors

bengl avatar davglass avatar snyamathi avatar

Watchers

 avatar  avatar  avatar

Forkers

bengl

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.