0.0.1 • Published 6 years ago

sprucelogjs v0.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

SpruceLogJS

SpruceLogJS is a simple logging library that I created for my own needs. It allows for a standardized version of logging in my projects.

Production Compile

Install with Yarn

$ yarn add https://github.com/CodeAffe/SpruceLogJS --save

Usage

The easiest way to get started is creating a new SpruceLog logger

let SpruceLog = require('SpruceLogJS');

var logger = new SpruceLog.logger({
    level: 'info'
});

SpruceLog supports a number of different logging levels. That are set upon creation of your logger. Each level displays each level after it

ie: all displays every log level under it. While error will show error and info log levels;

var levels = [
    'all', 
    'debug', 
    'error', 
    'info'
]

Logging also supports a source variable. That will output the source of the log for easy querying of your log files.

Logging out data is simple. To output a new log simply write:

logger.log({
    level: 'info',
    message: 'This is a test log',
    souce: 'Github'
})

Output: bash [HH:MM:SS] [Github] This is a test log

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

David Postlethwaite

License

Copyright © 2017 David Postlethwaite Licensed under the MIT license.