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 🙏

© 2026 – Pkg Stats / Ryan Hefner

logmatic

v3.0.3

Published

For anyone interested with supporting this passion project, please check out [Contributing](CONTRIBUTING.md).

Readme

CONTRIBUTERS REQUESTED

For anyone interested with supporting this passion project, please check out Contributing.

Logmatic

An overly complicated yet functional logger. Package: @tinnyterr/logmatic

Installation

For all systems, please use:

npm i logmatic --save-exact

For Typescript

Whenever possible, set the following setting in your tsconfig.json or such:

{
    "compilerOptions": {
        // ...
        "noPropertyAccessFromIndexSignature": false,
        // ...
    }
}

Or you must use the following to access your logging statements:

log["fatal"]("a");

As logmatic is currently in a very unstable state, many items may change in the future.

Usage

To get started, import the project into your file and initialise the logger:

const { Logger } = require('@tinnyterr/logmatic');
// OR
// import { Logger } from '@tinnyterr/logmatic';

const log = new Logger("name").loggers;

WAIT! If you wish to alter the logger down the line (eg add logger handler functions), you will need to save the Logger class for later. The above code just accesses all the logger function. For example:

const { Logger } = require('@tinnyterr/logmatic');
// OR
// import { Logger } from '@tinnyterr/logmatic';

const logClass = new Logger("name");
const log = logClass.loggers

// Do some stuff

log.info("blah blah")

logClass.addFunctions(() => { return })

For the default added levels, use the following:

| Function Call | Format | Colour | |----|----|----| |log.trace()|{time} [trace] {name} {...data}|Cyan| |log.debug()|{time} [debug] {name} {...data}|Blue Background| |log.info()|{time} [info] {name} {...data}|Blue| |log.warn()|{time} [warn] {name} {...data}|Yellow| |log.error()|{time} [error] {name} {...data}|Red| |log.fatal()|{time} [fatal] {name} {...data}|Red Background|

For your custom levels, please see Levels below

Options

The following section is expecting you have imported the class. It will then demonstrate how to set the option.

Console


Enabled

Whether console logging is enabled

Default: true

const log = new Logger("name", { console: { enabled: true }}).loggers

Log Level

The minimum level to log. This corresponds with the position in the array the level is. See Levels.

Default: 1

const log = new Logger("name", { console: { logLevel: 1 }}).loggers

Suppress Warnings

Whether to suppress warnings or errors emitted by the logger

Default: false

WARNING: This option is currently not in use.

const log = new Logger("name", { console: { supressWarnings: false }}).loggers

Format

Whether to format and colourise any JSON output

Default: false

const log = new Logger("name", { console: { format: false }}).loggers

Indent

Whether to indent any JSON output. Console.format must be true if Console.indent is greater than 0

Default: 0

const log = new Logger("name", { console: { indent: 0 }}).loggers

Files

WARNING: This option is currently not in use. Note: This module requires that several options are filled in tandem.

Enabled

Whether file logging is enabled

Default: false

const log = new Logger("name", { files: { enabled: false }}).loggers

Path

The log directory

In-depth: if path = /path/to/dir/ then logs will be stored as /path/to/dir/log.txt etc.

Default null

const log = new Logger("name", { files: { path: null }}).loggers

Naming

How to name the files

Default: null

WARNING: No example for this option as it is undetermined how it will be parsed.

File type

The type of file stored

Default: json

const log = new Logger("name", { files: { type: "json" }}).loggers

Web

WARNING: Web is currently in a unstable state and should not be used.

Enabled

Whether web (POST) logging is enabled

Default: false

const log = new Logger("name", { web: { enabled: false }}).loggers

URL

The URL to post to

Default: null

const log = new Logger("name", { web: { url: null }}).loggers

Data Type

The data type sent

Default: json

const log = new Logger("name", { web: { type: "json" }}).loggers

Every number

How many logs to store before POSTing to avoid getting ratelimited

Default: 5

const log = new Logger("name", { web: { every: 5 }}).loggers

Levels

This logger allows you to add your own levels, following out format. Formatted the following:

const log = new Logger("name", {}, { name: "level", colour:"red" }).loggers
// **OR**
const log = new Logger("name", {}, [{ name: "level", colour:"red" }]).loggers

The colour should be derived from the package console-log-colors or from a slimmed list included in the types.

[!WARNING] This will overwrite the default levels, so make sure you redefine them if you need them, and are just making an extra few.

[!NOTE] If you require the default levels back, then use:

new Logger("name", {}, [
  { name: "trace", colour: "cyanBright" },
  { name: "debug", colour: "blueBG" },
  { name: "info", colour: "blue" },
  { name: "warn", colour: "yellow" },
  { name: "error", colour: "red" },
  { name: "fatal", colour: "redBG" },
  // Your levels here...
]).loggers

Functions

The logger allows you to pass custom functions or callbacks to handle the logs on your own.

const function = (level: number, ...data: any[]) => {
    return { level, data }
}

const log = new Logger("name", { funcs: function}).loggers
// **OR**
const log = new Logger("name", { funcs: [function]}).loggers