Giter Club home page Giter Club logo

angie-log's Introduction

emblem

Angie Log

An extremely lightweight logging utility for NodeJS & the Angie Framework

npm version iojs support node support npm downloads build status Coverage Status documentation

NPM

About

Angie Log is designed as an extremely lightweight logging utility for NodeJS which will:

  • Prettify the terminal output using the Chalk package
  • Provide utilities for printing useful and informative terminal output
  • Create asynchronously written, non-blocking log files to maintain said useful and informative output based on well-defined JS log levels

Usage

npm i -g angie-log

If Used Standalone

import { default as Log } from 'angie-log';

// Call a new logger with defaults
let logger = new Log({
        outfile:    'log.log',              // Set the outfile
        file:       'log.log',              // Equivalent to `outfile`
        name:       'test',                 // Set the name of the logger
        timestamp:  true,                   // Controls whether the logfile output has a timestamp
        level:      'debug',                // Sets a single log level
        levels:     [ 'info', 'debug' ],    // Sets many available log levels
        logLevel:   'debug',                // Equivalent to `level`
        logLevels:  [ 'info', 'debug' ],    // Equivalent to `levels`
        silent:     false                   // Controls whether the log instance should output into the terminal as well
    }),
    err = new Log('log.log', 'test', true, 'error', false);

// Call the loggers with the string "test"
logger.info('test');
err.error('test');

// $setOutfile to change the output file
log.$setOutfile(`${process.cwd()}/angie.log`);

// $setName to change the name of the logger and what is logged in the outfile
log.$setOutfile('test');

// $setTimestamp to toggle timestamps in the log output
log.$setTimestamp(true);

// $setLevel to change the log level
log.$setLevel(true);

// $setSilent to prevent terminal output
log.$setSilent(true);

// Explicitly call the prettified terminal output
Log.info('test');
Log.debug('test');
Log.warn('test');
Log.error('test');

If Used in an Angie Application

Include the module in the same fashion as it is above, or wherever called modules are bound:

@Controller
class Test {
    constructor($Log) {
        $Log.info('The log module was included in a controller');
    }
}

The functions available on the Angie Log module are equivalent in either context.

For a list of Frequently Asked Questions, please see the FAQ and the CHANGELOG for an up to date list of changes. Contributors to this Project are outlined in the CONTRIBUTORS file.

Angie

Please see the site for information about the project, a quickstart guide, and documentation and the CHANGELOG for an up to date list of changes.

angie-log's People

Contributors

benderthecrime avatar

Watchers

 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.