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

@node-lightning/logger

v0.28.0

Published

Logging tool for Node-Lightning applications

Downloads

818

Readme

Node-Lightning Logger

Logger for Node-Lightning modules that supports multi-transport, multi-area+instance logging using standard util.format sprintf value formatting.

Getting Started

npm install @node-lightning/logger

To use the module you will need to create an area logger and include an optional instance identifier:

const { manager } = require("@node-lightning/logger");

const area = "TEST";
const instanceId = "12345678";
const log = manager.create(area, instanceId);

Then you can write debug, info, warn, and error messages by passing a message an a variadic number of values. You can pass text, values, sprintf syle strings, or a string and a list of values that will be appended to the end of the message.

log.debug("test");
log.info("hello");
log.warn("i'm warning you");
log.error("something went bad");
log.error(new Error("booooom"));
log.info("some stuff %j", { ok: true, foo: "bar" });
log.info("some values", 1, 2, 3, 4);
log.info("using %s formatting", "sprintf");

The above message should look similar to:

2019-07-22T13:28:37.854Z [DBG] TEST 12345678: test
2019-07-22T13:28:37.855Z [INF] TEST 12345678: hello
2019-07-22T13:28:37.855Z [WRN] TEST 12345678: i'm warning you
2019-07-22T13:28:37.855Z [ERR] TEST 12345678: something went bad
2019-07-22T13:28:37.856Z [ERR] TEST 12345678: Error: booooom
    at Object.<anonymous> (/code/go/src/github.com/altangent/node-lightning/packages/logger/test.js:9:11)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-07-22T13:28:37.856Z [INF] TEST 12345678: some stuff {"ok":true,"foo":"bar"}
2019-07-22T13:28:37.856Z [INF] TEST 12345678: some values 1 2 3 4
2019-07-22T13:28:37.856Z [INF] TEST 12345678: using sprintf formatting

Output

The default instance of the logger will output to:

  • console
  • node-lightning.log file located at the root of the application runtime