Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-composite-logger

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-composite-logger

Logger written in typescript. Includes a console channel by default. Allows to add other log channels by extending ILogChannel interface.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Composite logger

Use this package in your applications for logging. Out of the box the package outputs logs to console. You can create more custom channels and send data to them as well, dynamically add and remove them. The advantage of this logger is that it's easy to extend it.

npm install -S ts-composite-logger

Basic usage

  import {Logger, Console, LogLevel} from "ts-composite-logger";
  
  const console = new Console();  
console.setFormat("hh:mm:ss.SSS"); // this is default

global.logger = (new Logger())
	.addChannel(console)
	.setLevel(LogLevel.INFO);
	
  global.logger.info("VM connected");

Available log levels:

  • fatal
  • error
  • warn
  • info
  • debug

By default debug log level is selected. Which means that every log reqest will be fullfilled.

Date format options for console channel

Format string can be anything, but the following letters will be replaced (and leading zeroes added if necessary):

  • dd - date.getDate()
  • MM - date.getMonth() + 1
  • yy - date.getFullYear().toString().substring(2, 4)
  • yyyy - date.getFullYear()
  • hh - date.getHours()
  • mm - date.getMinutes()
  • ss - date.getSeconds()
  • SSS - date.getMilliseconds()
  • O - timezone offset in +hm format (note that time will be in UTC if displaying offset)

The underlying package to format dates is date-format. You can find more details here

Keywords

FAQs

Package last updated on 11 Oct 2019

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