New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

colorful-log-levels

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorful-log-levels

A basic logger for JS apps to write files for each log level

  • 0.2.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 22 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc