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

@emnudge/logpipe

v0.0.9

Published

*Get clarity on development logs*

Downloads

24

Readme

Logpipe logpipe logo

Get clarity on development logs

Checkout the docs or see it in action in this online demo!

Installation

There is no build step in this codebase, so you can install it directly from git if you want.

npm i -g https://github.com/EmNudge/logpipe.git
# or
npm i -g @emnudge/logpipe

Usage

$ some-other-program | logpipe

> server running on http://localhost:7381

Then go to the URL and inspect away!

logpipe parameters:

  • --port <number>
    • Choose a specific port (instead of random). Useful for command runners like nodemon.
  • --title <some text>
    • Title for the page. Useful if you have multiple logpipes open at once.

Redirecting Stderr

Many programs will output their logs to stderr instead of stdout. If logpipe is not capturing anything and you still see output in your terminal, this is probably what's happening.

You can use bash redirection to fix this.

my-program 2>&1 | logpipe # note the "2>&1"

Motivation

When dealing with various codebases in development, you'll come across perhaps hundreds of logs per minute. Some of these are supposed to be useful. As it's just sending out unstructured text, it can be hard to find what you want. Furthermore, it often lacks syntax highlighting. It is hard to know where one log ends and another starts.

In contrast, something like your browser's dev console allows filtering, highlighting, and inspection of "unstructured" logs. The goal is to supercharge this to be used for any system that outputs any kind of logs.

Behavior

This is a tool meant primarily for development. Therefore, the intention is to value assistance over correctness.

This allows us the following interesting features:

  • Logpipe will syntax highlight logs that previously had no syntax highlighting.
  • It will automatically apply tags to logs for you to search over.
  • It will attempt to group logs that seem related (based on indentation or language grammar)

It also allows us to live-filter logs while retaining the log state - something already present in most log inspection tools.

Development

It has been helpful to use something like nodemon during development to automatically restart the server when the code changes.

There is a file called out.js which is purely used to simulate logs like in a regular application.

out.js parameters:

  • --delay <number>
    • delay in milliseconds between each log
  • --iterations <number>
    • number of iterations to run (default Infinity)
nodemon --exec 'node out.js | node index.mjs -p 7280' -e ts,html,js,mjs,css

Similar Tools (Alternatives)

The primary goal of logpipe is to simplify viewing and searching real-time development logs. If this is not your exact use-case, you may be better served by other tools.

For a direct CLI-specific alternative, I quite like tailspin.

For viewing structured logs in the CLI, check out klp or lnav.

Web UIs are going to be the easiest for viewing logs individually and filtering on them. logscreen and logdy both exist in this category, but neither applies syntax highlighting or function well with unstructured logs.

Logpipe seems to exist solely in this niche of "live webui view on unstructured logs with automatic syntax highlighting". If you find another tool that fits into this category, file an issue and I'll add it to this section.