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

@bodal/gnomon

v2.0.3

Published

Utility to annotate console logging statements with timestamps and find slow processes

Downloads

7

Readme

gnomon

A command line utility, a bit like moreutils's ts, to prepend timestamp information to the standard output of another command. Useful for long-running processes where you'd like a historical record of what's taking so long.

Example

basic

Piping anything to gnomon will prepend a timestamp to each line, indicating how long that line was the last line in the buffer--that is, how long it took the next line to appear. By default, gnomon will display the seconds elapsed between each line, but that is configurable.

You can display total time elapsed since the process began: total

You can display an absolute timestamp: absolute

You can also use the --high and/or --medium options to specify a length threshold in seconds, over which gnomon will highlight the timestamp in red or yellow. And you can do a few other things, too.

fancy

If the realtime timestamp updating is distracting or incompatible with your terminal, it can be disabled:

norealtime

Options

--type=<elapsed-line|elapsed-total|absolute>        [default: elapsed-line]
-t <elapsed-line|elapsed-total|absolute>

  Type of timestamp to display.
    elapsed-line: Number of seconds that displayed line was the last line.
    elapsed-total: Number of seconds since the start of the process.
    absolute: An absolute timestamp in UTC.

--format="format"                                   [default: "H:i:s.u O"]
-f "format"

  Format the absolute timestamp, using PHP date format strings. If the type
  is elapsed-line or elapsed-total, this option is ignored.

--ignore-blank                                      [default: false]
--quiet
-q
-i

  Do not prepend a timestamp to blank lines; just pass them through. When
  this option is active, blank lines will not trigger an update of elapsed
  time. Therefore, if a lot of blank lines appear, the prior timestamp will
  display the total time between that line and the next non-blank line
  (if the type is elapsed-time was selected).

--real-time=<number|false>                          [default: 500]
-r                                                  [non-tty default: false]

  Time increment to use when updating timestamp for the current line, in
  milliseconds. Pass `false` to this option to disable realtime entirely,
  if you need an extra performance boost or you find it distracting. When
  realtime is disabled, the log will always appear one line "behind" the
  original piped output, since it can't display the line until it's
  finished timing it.

--high=seconds
-h seconds

  High threshold. If the elapsed time for a line is equal to or higher than
  this value in seconds, then the timestamp will be colored bright red.
  This works for all timestamp types, including elapsed-total and absolute,
  where the elapsed line time is not actually displayed.

--medium=seconds
-m seconds

  Medium threshold. Works just like the high threshold described above, but
  colors the timestamp bright yellow instead. Can be used in conjunction
  with a high threshold for three levels.

Notes

  • If a high and/or a medium threshold are specified, then all timestamps not meeting that threshold will be colored bright green.
  • If you pipe the output of gnomon into another command or a file (that is, not a tty) then the real-time option will be disabled by default and each line will appear only after it has been timed. You can force realtime by sending a --real-time=<ms> argument explicitly, but the ANSI codes would probably interfere with whatever you were trying to do. The sane default is to omit fancy stuff, like colors and escape sequences, when logging text directly to a file.

Installation

with npm do:

npm install -g gnomon

License

gnomon uses the MIT license.