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

@baileyherbert/logging

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@baileyherbert/logging

Just another logging solution.

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-35.71%
Maintainers
1
Weekly downloads
 
Created
Source

Logging

This package offers a logging solution based on a modular delivery concept. Simply create a logger instance, attach a delivery transport (such as console, file, or your own), and start logging!

Installation

npm install @baileyherbert/logging

Example

Create a logger instance. This is what we'll use to actually write output.

const logger = new Logger();

Create a console transport. This will print our output to the console. You can define a minimum log level for output. We'll use Trace here which will capture all levels of output.

logger.createConsoleTransport(LogLevel.Trace);

Create a file transport. This will send our output into a file. We'll set a minimum log level of Information to keep the logs minimal. Please note that the file transport has automatic log rotation enabled by default, but you can customize or disable this behavior.

logger.createFileTransport(LogLevel.Information, {
    fileName: 'logs/output.log'
});

Done! Now use the logger to write output to both the console and log file at once.

logger.trace('Starting example program');
logger.info('Hello world');

Both of those transports have many customization options, and you can also create your own. Check the transports guide to learn more.

Documentation

Keywords

FAQs

Package last updated on 02 Jun 2022

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