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

lumberjackjs

v1.2.0

Published

Plugable JavaScript logging.

Downloads

6

Readme

Lumberjack

Bower version NPM version

Plugable JavaScript logging.

$ bower install lumberjack
$ npm install lumberjackjs

Creating a new Lumberjack

Create one master instance if you'd like, or many instances for each system.

var log = Lumberjack();

Enable logging

Logging is off by default to avoid memory leaks and conserve script performance. There are several options to control logging:

// Update localStorage then refresh the page..
localStorage.lumberjack = 'on';
// ..or force logging on when creating a new instance..
var log = Lumberjack(true);
// ..or turn logging on/off during runtime.
log.enable();
log.disable();

Log some information

Each log entry is tied to a channel and is created on the fly. This data can be an Object, String, Number, or Boolean.

log('signin', 'User has finished signing in.');

Clear log data

Log data may be reset manually for either a single channel or the entire log.

// Clears all log data.
log.clear();
// Clears only the 'a-channel' data.
log.clear('a-channel');

Attach some callbacks

You can attach side-effects to your log channels for analytics tools. The data object is whatever data gets logged when the event trips. You can even attach multiple callbacks to the same channel.

log.on('contentload', function (data) {
    analytics.report(data);
});

Trigger events

Define your behavior once and trigger it multiple times.

log('contentload', {
    how: 'scroll',
    speed: 851
});

Debug a subsystem

Get the logging information you care about with timestamps of when it happened. Every log entry has a timestamp so you can tell when events happened.

log.readback('gallery');
log.readback('gallery', true); // Pretty-print

Quickly check on what log channels are in use.

log.readback.channels(); // Array of channel names
log.readback.channels(true); // Pretty-print

View all events in order

The master record contains all log entries in order.

log.readback.master();
log.readback.master(true); // Pretty-print

Remove side-effects

You can disable all existing callbacks for a single channel.

log.off('scroll');

Analyzing entries

All log entries take the form:

{
    time: // timestamp when entry was logged
    data: // the logged data
    channel: // channel of entry
    id: // id of entry in master record
}

  • See: http://cobbdb.github.io/lumberjack/
  • See: http://github.com/cobbdb/lumberjack
  • License: MIT