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

web-logger

v0.0.5

Published

Real-time logger with a built-in web interface for command-line node apps.

Downloads

1

Readme

web-logger

Real-time logger with a built-in web interface for command-line node apps.

Features

  1. View your app's logs on stdout or in a local web interface.
  2. Callsite logging (file and line number that logged each line).
  3. Log arbitrary JSON metadata and inspect it in the browser.
  4. Streaming logs in the browser: you get live tail -f behavior.
  5. You can run the program on one host and see logs on another via the web interface.
  6. You get basic system stats for free, which is useful if you are running the program on a different host.
  7. 100% cloud-free, all local, works without an Internet conenction.
  8. MIT-Licensed. Safe for use and modification in all types of projects, including commercial ones.

Usage

npm install --save web-logger

And then in any/all source files:

var lg = require('web-logger');

lg(lg.INFO, 'Hello!', {some: 'data'});
lg(lg.ERROR, 'A bad thing happened!');
lg(lg.STATUS, 'Starting a timer now.');

setInterval(function() {
  lg(lg.INFO, 'The time is ' + (new Date()), {
    rand: Math.random(),
  });
  if (Math.random() < 0.2) {
    lg(lg.SUCCESS, 'Something good happened!', {
      someId: 123
    });
  }
  lg(lg.END);  // terminates logserver process,
               // lets your program die.
}, 3000);

When you run your program, you should see something like this on stdout:

Logserver listening at http://localhost:40270/index.html

Visit the URL for a pretty page of live, streaming logs. When you're done looking at the logs, kill your program with a Ctrl-C or similar method. If you don't want to do this, you can disable the web interface entirely with the --disable-logserver command-line flag.

If you don't feel like opening a web browser, run your program with the --stdlog command-line option to additionally log to stdout as well as the internal memory buffer (i.e., the web interface).

If you don't like the random port that the system picks for the logserver to listen on, run your program with a --logport N option, where N is the port you'd rather have the logserver listen on.