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

logmap

v2.0.1

Published

Filter & format new-line-deleimted json streams using simple object-path selectors.

Downloads

2

Readme

SYNOPSIS

Filter & format new-line-deleimted json streams using simple object-path selectors.

MOTIVATION

This is not a json transform tool. It's just a simple filter & format tool.

INSTALL

npm install logmap -g

USAGE

Given some program is outputting newline-delimted-json...

{ "date": "2015-06-25T01:14:21.196+0600", "level": "info", "value": { "msg": "Lorem ipsum dolor sit amet.", "sources": ["C++", "JS"] } }
{ "date": "2015-04-25T01:32:21.196+0600", "level": "info", "value": { "msg": "Mollit anim id est laborum.", "srouces": ["C++", "JS"] } }

Pipe it to the following the reduce the output using simple object-path selectors...

cat ./sample.json | logmap date level value.msg
["2015-06-25T01:14:21.196+0600", "info", "Lorem ipsum dolor sit amet."]
["2015-04-25T01:32:21.196+0600", "info", "Mollit anim id est laborum."]

ARRAYS & ACCESSING VALUES

You can also access items in an array like this foo.bar.1.thing. In fact, you can use any of the object selectors found here.

FORMATTING OUTPUT

sprintf-ish things like %s, %80s, %d and %j.

cat ./sample.json | logmap date level value.msg -f "[%moment(DD HH:mm)]: (%s) %s"
[14 21:32]: (info) Lorem ipsum dolor sit amet.
[24 21:32]: (info) Mollit anim id est laborum.

COLOR

%chalk(inverse.red), invokes chalk. there are a few shortcuts like %red, %blue, etc. use %chalk(...) for more complicated things.

DATES

Anything inside the %moment(...) like %moment(MM YY d:mm) just invokes moment

EXPRESSIONS

Sometimes you dont want to putput a record based on some simple boolean logic, for that you can use quoted expressions with >, <, >=, <=, ==, !=.

cat ./sample.json | log.name log.message "log.priority > 2"
cat ./books.json | log.name "title == \"Programming\""

OPTIONS

If you write a long query, you can save it so you don't have to write it again.

SAVE

cat ./sample.json | logmap user.name.last, user.name.first, user.age -f "%s, %s (%s)" -s myQuery

LOAD

cat ./sample.json | logmap -l myQuery

DELETE

logmap -d myQuery