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

consola

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consola

Elegant Console Wrapper

  • 3.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
increased by4.12%
Maintainers
3
Weekly downloads
 
Created

What is consola?

The consola npm package is a console logger for Node.js and browsers. It provides an easy-to-use API for logging information, warnings, errors, and more, with a focus on developer experience and universal compatibility.

What are consola's main functionalities?

Basic Logging

Consola allows you to log messages at various levels, such as info, warn, and error, which are color-coded and formatted for better readability.

const consola = require('consola');
consola.info('Information message');
consola.warn('Warning message');
consola.error('Error message');

Reporters

You can add custom reporters to modify how logs are displayed or processed, giving you control over the logging output.

const consola = require('consola');
consola.addReporter({
  log(logObj) {
    console.log(logObj.message);
  }
});

Tagged Logging

Consola supports tagged logging, which allows you to prepend a tag to your log messages, making it easier to filter and identify logs related to specific parts of your application.

const consola = require('consola').withTag('my-tag');
consola.info('Tagged information message');

Log Level Control

You can control the log level threshold, which determines the minimum level of logs that will be displayed, allowing you to filter out less important logs in different environments.

const consola = require('consola');
consola.level = 3; // Only display logs with a level of 3 (errors) or higher

Other packages similar to consola

Keywords

FAQs

Package last updated on 05 Jul 2023

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