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

simplog

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplog

A very simple logging module. Because all the others are too much. This module relies on the node util module to provide timestamping and formatting of log messages. Messages are written to stdout via util.log.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

simplog

The simplest useful log module imaginable.

Writes messages to stdout (as in [12 Factor App] (http://www.12factor.net/logs)) using the node.js util.log and util.format methods.

Installation
npm install simplog
Usage

Supports error, info, warn, debug and a handy event method. It's written in coffee script and you should be too (that was deliberate).

log.error "this is an error"
log.info  "this is informational"
log.warn  "this is a warning"
log.debug "this is a debug message and will only show up if process.env.DEBUG or window.debug is truthy"
log.event "this will log with the type [EVENT] and will only show up if process.env.DEBUG is truthy"
Formatting

It's even possible to use string formatting with it, like:

log.info "that %s looked like %j", object_name, object

Under the covers it's just using node's util.format and supports what you would expect.

Output

As of 0.0.5 the output includes a pid as follows

22 May 22:07:44 - [15794] [ERROR] look ma, an error

If you decide you like the old way, sans pid:

22 May 22:07:44 - [ERROR] look ma, an error

you can make process.env.NOLOGPID truthy and it will go away. If there's something called window in the global scope, we'll skip the PID in any output. Reasonable?

Keywords

FAQs

Package last updated on 29 Jul 2016

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