npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

log-simple

v0.1.3

Published

Super Simple JavaScript Logging based on console.log with unix terminal colors and iso timestamps

Downloads

5

Readme

log-simple

Super Simple JavaScript Logging based on console.log with unix terminal colors and iso timestamps

No external dependencies, super lightweight!

log-simple example

Installation

npm install log-simple --save

Usage

log-simple is component-based, this makes it easy to figure out where logs are coming from. To get started with log-simple, do this:

var log = require('log-simple')('component-name');
log.info("Hello World!");

You don't need to specify a component name (only recommended when you have a small, single file project):

var log = require('log-simple')({init: false});
log.info("Hello World!");

Note: If you specify an object as the first argument, it's interpreted as the config, not the component name. I'm setting init to false here, because we don't need to see the init message if we only have one component.

Configuration

log-simple can also be configured. The values in the example below are the default values. This should be self-explanatory:

var log = require('log-simple')('component-name', {
    debug: true, // show debug messages
    time: true, // show time
    init: true // show component init message
  });

Log levels

There are the following log levels: log.debug() log.info() log.warn() log.error() log.critical()

log-simple also has minimalistic log levels, for the lazy (or minimalistic) ones: log.d() log.i() log.w() log.e() log.c()

If you want to make your code especially short (and unreadable), you can require log-simple as l and then do l.i('Hello World!').

Logging objects

log-simple is basically a wrapper for console.log. This means you can use it just like console.log. To log an object, simply do:

var log = require('log-simple')({init: false});
var test = {hello: 'world'};
log.debug('Testing object logging', test);