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

adze

v2.1.0

Published

A universal, modern, and extendable logging library for JavaScript and TypeScript.

Downloads

2,428

Readme

Adze

Adze Logo

build workflow node-lts apache 2.0 minzip dependency count

Please visit our official docs at adzejs.com.

Why is this named Adze?

A drawing of a man using an adze to shape a log

Photo from Wikipedia

Adze - a cutting tool that ... is used chiefly for shaping wood.

(Pronounced "Ads") Adze was chosen as a name for this library to maintain solidarity with the logging puns and to emphasize that this library is a tool for shaping the logs of your application.

Why should I use Adze?

Adze is UNIVERSAL, meaning it can run in any JS runtime (node, bun, deno, browser) without any special considerations.

Compared to existing Javascript logging libraries, Adze sets itself apart because it is universal, meaning it can run in both server and browser environments with zero config. Other libraries, such as Winston or Bunyan only support server environments. Libraries like Pino and Log4JS support both environments, but it either requires some configuration or it only provides you with a very limited feature set. None of them directly support Deno or Bun.

Javascript frameworks have been shifting to server-side rendering (SSR) and to micro-frontend style architectures. Both of these architecture approaches present unique challenges with logging in a production-ready environment. Because Adze is universal by nature, you can write your logs the same way throughout your application and it will just work.

Aside from universalism, Adze also offers many other compelling features:

  • First-class TypeScript support (not bolted-on)
  • Wraps and extends the entire standard API
  • A convenient chainable API
  • Log Listeners for capturing log data
  • Middleware support for plugins and transporting logs
  • Log annotations such as namespaces, labels, and other meta data
  • Four formats supported out of the box:
    • Pretty - Human readable logs that are easy on the eyes
    • JSON - Machine readable logs that are compatible with the Bunyan CLI
    • Standard - Human readable stdout logs
    • Common - Logs that adhere to the Common Log Format
  • Everything is customizable and configurable
  • Tools for caching, filtering, and recalling logs
  • Support for creating log thread to track data across multiple scopes
  • Convenient child logger API's
  • and much more...

Here is a simple preview:

Preview of Adze logs

This preview was generated from the same code executed in both the browser (left) and the node (right) environments.

What does the API look like?

As stated above, Adze offers an easy to use, chainable API. To create a log you simply chain together an Adze log instance with a series of modifiers and then end with a terminator. Here's an example of creating a log with a namespace:

import adze from 'adze';

adze.namespace('example').log('Example log');

The output of this would look like the following:

Adze log example

Install the Package

You can install Adze from NPM using the following command:

# npm
npm install -S adze

# pnpm
pnpm add adze

Version Requirements

| Dependency | Supported Versions | Notes | | ---------- | ------------------ | ---------------------------------------- | | node | >= 18.19.x | When running Adze in a Node environment. | | bun | >= 1.1.26 | When running Adze in a Bun environment. | | deno | >= 1.46.3 | When running Adze in a Deno environment. | | typescript | >= 5.5.2 | When using Adze with TypeScript |

TypeScript Configuration

Adze is built to be used with TypeScript and we highly encourage using it in this way.

When building your project with TypeScript, you need to make sure you use the "DOM" lib because Adze supports both the web browser and Node. Also, to support the dependencies of Adze, you'll need to add "esModuleInterop": true to your tsconfig as well.

For more information about configuring TypeScript, go to https://www.typescriptlang.org/docs/handbook/tsconfig-json.html.

Example

{
  "compilerOptions": {
    // ...your other options
    "lib": ["DOM"],
    "esModuleInterop": true
  }
}

Importing Adze

Adze comes bundled with a few different ways of accessing it. Here are some examples:

CommonJS

const { adze } = require('adze'); // Or alternatively `const adze = require('adze').adze;`

adze.log('Hello World!');

ESM / TypeScript

import adze from 'adze';

adze.log('Hello World!');

Documentation

Please visit our official docs at adzejs.com.