Socket
Socket
Sign inDemoInstall

console-stamp

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-stamp

Patch NodeJS console methods in order to add timestamp information by pattern


Version published
Weekly downloads
351K
increased by5.31%
Maintainers
1
Weekly downloads
 
Created

What is console-stamp?

The console-stamp npm package is used to add timestamps to console output in Node.js applications. It enhances the standard console methods (log, info, warn, error) by prefixing them with a timestamp, making it easier to track when specific log entries were made.

What are console-stamp's main functionalities?

Basic Timestamping

This feature adds a basic timestamp to all console log messages. By requiring the console-stamp package and passing the console object to it, all subsequent console.log calls will include a timestamp.

const consoleStamp = require('console-stamp')(console);
console.log('This is a log message.');

Custom Timestamp Format

This feature allows you to customize the format of the timestamp. By passing an options object with a 'format' property, you can specify the desired timestamp format.

const consoleStamp = require('console-stamp')(console, { format: 'yyyy-mm-dd HH:MM:ss.l' });
console.log('This is a log message with a custom format.');

Custom Label

This feature adds a custom label to the log messages. By setting the 'label' property to true in the options object, you can include a label in the log output.

const consoleStamp = require('console-stamp')(console, { label: true });
console.log('This is a log message with a custom label.');

Custom Prefix

This feature allows you to add a custom prefix to the log messages. By setting the 'prefix' property in the options object, you can include a custom prefix in the log output.

const consoleStamp = require('console-stamp')(console, { prefix: '[LOG]' });
console.log('This is a log message with a custom prefix.');

Other packages similar to console-stamp

Keywords

FAQs

Package last updated on 28 Feb 2014

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