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

@lage-run/reporters

v1.2.7

Published

Log reporters for Lage

Downloads

24

Readme

@lage-run/reporters

This package provides some default built-in reporters to be used inside @lage-run/cli (and lage, the main entry point to the tool). The Reporter interface comes from @lage-run/logger.

NpmLogReporter

This reporter uses the npmlog package that is the same logger used by npm. It is considered stable, and is chosen because of its ability to log in a "standard" way with a clear distinction between "INFO", "WARN", "ERR!", "VERB", etc. npmlog by default writes to the stderr stream, so be aware that these logs are written to that.

To use it, look at how it is instantiated inside the unit tests. Here's an example of a basic usage:

const reporter = new NpmLogReporter({ grouped: false, logLevel: LogLevel.verbose });

reporter.log({
  data: {
    target: createTarget("a", "task"),
    status: "running",
    duration: [0, 0],
    startTime: [0, 0],
  } as TargetStatusEntry,
  level: LogLevel.verbose,
  msg: "test message",
  timestamp: 0,
});

It will produce a summary that looks something like this in case of errors, displaying any explicit errors in a summary section:

info ➔ start a test
info ✓ done a test - 10.00s
info ➔ start b build
info ✓ done b build - 30.00s
info ➔ start a build
info ✖ fail a build
info 🏗 Summary
info 
info Nothing has been run.
info ----------------------------------------------
ERR! [a build] ERROR DETECTED
ERR! 
ERR! test message for a#build
ERR! test message for a#build again, but look there is an error!
ERR! 
info ----------------------------------------------
info Took a total of 1m 40.00s to complete

JsonReporter

Every log entry being sent to this reporter will write out in a raw JSON format. When piped to another processor, be sure to handle the newline-delimited JSON objects. This is useful for making a tool on top of lage to post process the run in an automation step or as part of a larger pipeline of work.

AdoReporter

Azure DevOps contains a set of logging commands that can make the logged messages more easily parsed by humans. These formatting commands include the ability to collapse logs in a group. To support this, lage also provides a built-in Azure DevOps reporter. It outputs roughly into something like this:

##[group] a test success, took 10.00s
INFO:  ➔ start a test
VERB:  |  test message for a#test
VERB:  |  test message for a#test again
INFO:  ✓ done a test - 10.00s
##[endgroup]
##[group] b build success, took 30.00s
INFO:  ➔ start b build
VERB:  |  test message for b#build
VERB:  |  test message for b#build again
INFO:  ✓ done b build - 30.00s
##[endgroup]
##[group] a build failed, took 60.00s
INFO:  ➔ start a build
VERB:  |  test message for a#build
VERB:  |  test message for a#build again, but look there is an error!
INFO:  ✖ fail a build
##[endgroup]
##[section]Summary
INFO: a build failed, took 60.00s
INFO: a test success, took 60.00s
INFO: b build success, took 60.00s
[Tasks Count] success: 2, skipped: 0, pending: 0, aborted: 0
##[error] [a build] ERROR DETECTED
##[error] 
##[error] test message for a#build
##[error] test message for a#build again, but look there is an error!
##[error] 
INFO:  Took a total of 1m 40.00s to complete