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

logover

v2.0.0

Published

A blazingly brilliant logger for JavaScript applications

Downloads

221

Readme

Logover

A blazingly brilliant logger for JavaScript applications. The logger uses eye-catching output to make it easy to spot your logs.

Usage

import { Logger, Options, Assert } from "logover";
const logover = new Logger({
  level: "debug",
  trace: ["debug", "warn"],
});

logover.debug("0 with trace");
logover.info("1");
logover.warn("2 with trace");
logover.error("3");

const assert = new Assert();

assert.equal(1, 2);
assert(false);

What would get logged to the console:

🟢 DEBUG:  2022-08-06 18:44:56 0 with trace
Logover: [DEBUG]
    at file:///home/shauh/logover/temp-test/index.js:226:9
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)

🔵 INFO:  2022-08-06 18:44:56 1
🟠 WARN:  2022-08-06 18:44:56 2 with trace
Logover: [WARN]
    at file:///home/shauh/logover/temp-test/index.js:228:9
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)

🔴 ERROR:  2022-08-06 18:44:56 3

Logover: Assertion failed: 1 !== 2
    at Assert.equal (file:///home/shauh/logover/temp-test/index.js:45:21)
    at file:///home/shauh/logover/temp-test/index.js:255:8
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
    at async loadESM (node:internal/process/esm_loader:85:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  stackTraceDepth: 2,
  expected: 1,
  actual: 2
}

Options

  • level: The minimum level to log.
  • info: The prefix for info logs.
  • debug: The prefix for debug logs.
  • warn: The prefix for warn logs.
  • error: The prefix for error logs.
  • trace: The log level to show stack trace for.
  • stackTraceDepth: The depth of stack trace to show.
  • timestamp: The timestamp format.

Full Example

See test/index.ts

Output:

🟢 DEBUG:  2022-08-06 18:44:56 0 with trace
Logover: [DEBUG]
    at file:///home/shauh/logover/temp-test/index.js:226:9
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)

🔵 INFO:  2022-08-06 18:44:56 1
🟠 WARN:  2022-08-06 18:44:56 2 with trace
Logover: [WARN]
    at file:///home/shauh/logover/temp-test/index.js:228:9
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)

🔴 ERROR:  2022-08-06 18:44:56 3
🙂  I get logged. I have no date
⚠️  I get logged
Logover: [WARN]
    at file:///home/shauh/logover/temp-test/index.js:241:9
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)

🔴  I get logged
🔴  I get logged
🔴 18:44:56.385 What time I am logged?
⚠️ [Sunday the 06 of August in the year 2022] That is a nice date format.
Logover: [WARN]
    at file:///home/shauh/logover/temp-test/index.js:253:9
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)

file:///home/shauh/logover/temp-test/index.js:45
      const error = new LogError(
                    ^

Logover: Assertion failed: 1 !== 2
    at Assert.equal (file:///home/shauh/logover/temp-test/index.js:45:21)
    at file:///home/shauh/logover/temp-test/index.js:255:8
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
    at async loadESM (node:internal/process/esm_loader:85:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  stackTraceDepth: 2,
  expected: 1,
  actual: 2
}