You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

fancy-log

Package Overview
Dependencies
9
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

fancy-log

Log things, prefixed with a timestamp.


Version published
Maintainers
2
Created

Package description

What is fancy-log?

The fancy-log package is designed for logging messages in Node.js applications with timestamps. It's particularly useful for development environments where tracking the timing of various operations is crucial. The package provides a simple API to prepend a timestamp to your log messages, making it easier to follow the flow of operations and debug issues related to timing.

What are fancy-log's main functionalities?

Basic Logging

This feature allows you to log any message with a timestamp. It's the fundamental functionality of fancy-log, making it straightforward to add time-stamped logging to your application.

const log = require('fancy-log');
log('Hello, world!');

Other packages similar to fancy-log

Changelog

Source

2.0.0 (2022-01-07)

⚠ BREAKING CHANGES

  • Highlight timestamp as util.inspect hightlights Dates (#23)
  • Normalize repository, dropping node <10.13 support (#21)

Features

  • Highlight timestamp as util.inspect hightlights Dates (#23) (27c71a9)

Miscellaneous Chores

  • Normalize repository, dropping node <10.13 support (#21) (4083943)

Readme

Source

fancy-log

NPM version Downloads Build Status Coveralls Status

Log things, prefixed with a timestamp.

Usage

var log = require('fancy-log');

log('a message');
// [16:27:02] a message

log.error('oh no!');
// [16:27:02] oh no!

API

log(msg...)

Logs the message as if you called console.log but prefixes the output with the current time in HH:mm:ss format.

log.error(msg...)

Logs the message as if you called console.error but prefixes the output with the current time in HH:mm:ss format.

log.warn(msg...)

Logs the message as if you called console.warn but prefixes the output with the current time in HH:mm:ss format.

log.info(msg...)

Logs the message as if you called console.info but prefixes the output with the current time in HH:mm:ss format.

log.dir(msg...)

Logs the message as if you called console.dir but prefixes the output with the current time in HH:mm:ss format.

Styling

If the terminal that you are logging to supports colors, the timestamp will be formatted as though it were a Date being formatted by util.inspect(). This means that it will be formatted as magenta by default but can be adjusted following node's Customizing util.inspect colors documentation.

For example, this will cause the logged timestamps (and other dates) to display in red:

var util = require('util');

util.inspect.styles.date = 'red';

License

MIT

Keywords

FAQs

Package last updated on 07 Jan 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc