0.2.1 • Published 6 years ago

colorful-log-levels v0.2.1

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

colorful-log-levels

Build Status

About

This is a really basic logging tool, still in development.

Why use this?

This is a very small and basic logging tool to give your logging some readability and tracability. Based on the native console.log node.js.

Getting Started

This project is available via NPM:

npm install --save colorful-log-levels

You should have Node 6.11 and tsc 2.1 or higher to be safely running this.

For TypeScript setup is simple:

import Logger from 'colorful-log-levels';
import { logLevels } from 'colorful-log-levels/enums';

// First argument is the directory you want the logger to write files to
// Second is the level you want to subscribe to 
// Last argument is if you want logs to be written to file
let logger = new Logger('./logs', logLevels.error, true);

let test = `${6+1}`
// Template literals are supported
logger.debug(`Test`);
// So are indefinite arguments (rest params)
logger.debug(test, 'Debug message');

// Errors are marked as 'any' but support native errors AND custom strings
logger.error('Very bad!!');
logger.error(Error('Oh no!!!!'), new Error('ALSO VERY BAD'));

For JS requires slightly different:

const Logger = require('colorful-log-levels').default;
let logLevels = require('colorful-log-levels/enums').logLevels;

// First argument is the directory you want the logger to write files to
// Second is the level you want to subscribe to 
// Last argument is if you want logs to be written to file
let logger = new Logger('./logs', logLevels.error, true);

let test = `${6+1}`
// Template literals are supported
logger.debug(`Test`);
// So are indefinite arguments (rest params)
logger.debug(test, 'Debug message');

Issues

Do you have any issues or recommendations for this package? Feel free to open an issue in the issue section. I'm always happy to help :D

License

This project is licensed under the MIT License - see the LICENSE.md file for details

0.2.1

6 years ago

0.2.0

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago