ZTracer Logo

Tracer

Every log has a trail.

Lifecycle Hooks Visual Groups Type‑safe ~6.5 KB CJS + ESM Zero Deps

A lightweight, typed logging utility with a powerful lifecycle. Simple, clean, and developer‑friendly — flexible enough for production.

~6.5 KB · Zero deps · CJS + ESM

What is ZTracer?

ZTracer is a tiny, typed logging utility for JavaScript and Node.js. It makes console output visually readable by grouping logs with colors and backgrounds.

More than a pretty logger. ZTracer features a log lifecycle with global, group, and per‑log callbacks — giving you full control over every log. With the right configuration, it's a lightweight, reliable solution for production as well as local development.

Not an enterprise logging system with built‑in transports. Just enough — and fully under your control.

At a glance
  • Simple, clean API
  • Type‑safe (TypeScript)
  • Colored visual groups
  • Log lifecycle callbacks
  • ~6.5 KB · Zero deps
  • CJS + ESM
  • Node.js + Browser

Key Features

Log Lifecycle

Global → Group → Specific callbacks. Hook into every log, transform data, or send telemetry.

Visual Grouping

Assign colors and backgrounds to different categories. Instantly distinguish API from DB logs.

Timing

Measure execution time of any async/sync function with a clean, grouped timer.

JSON / Table

Log objects and arrays as tables or expandable directories.

TypeScript First

Full type safety with generics. Define your group names and get autocomplete.

Dual Module

Supports both CommonJS and ES Modules. Use it anywhere.

ZTracer vs Others

Library Size Deps TS Groups Lifecycle Node/Browser Best for
ZTracer ~6.5 KB 0 Both Dev logging, production with hooks
console.log 0 Both Basic output
debug ~12 KB 0 Node Namespace logging
pino ~30 KB few Node Production JSON logging
winston ~150 KB many Node Enterprise logging

When to use ZTracer

  • Local development & debugging
  • Quick prototyping
  • Visual separation of log types
  • Production with custom lifecycle hooks
  • Learning logging concepts

When not to use

  • Large-scale log aggregation
  • High‑performance logging (millions of ops)
  • JSON‑only pipelines
  • Enterprise monitoring systems