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

hb-smart-logger

v1.0.6

Published

Production-ready Winston logger with daily rotation, safe JSON handling, and logger.log() alias

Downloads

647

Readme

HB Smart Logger 🚀

HB Smart Logger is a production-ready logging solution for Node.js built on top of Winston, designed to be simple to use, safe by default, and scalable for real-world applications.

It works out of the box with zero configuration, yet provides advanced features like daily log rotation, safe JSON logging, and structured multi-argument logging.


✨ Key Benefits

  • Zero-Config Setup
    Just install and start logging — no boilerplate required.

  • Safe Object Logging
    Handles circular JSON safely (no crashes, no [object Object]).

  • Daily Log Rotation
    Automatically rotates logs by day and size, with compression and retention.

  • Separate & Combined Logs
    Keeps per-level logs (error, warn, info, debug) and a full combined log.

  • Multi-Argument Support
    Log multiple values like console.log() — strings, objects, and errors.

  • logger.log() Alias
    Drop-in replacement for console.log() — routes to info level internally.

  • Error Stack Traces Included
    Errors automatically log full stack traces.

  • Production-Ready Defaults
    Designed for APIs, microservices, background workers, and cron jobs.


📦 Installation

npm install hb-smart-logger

🚀 Quick Start

const logger = require("hb-smart-logger");

logger.log("Application started");
logger.info("Server listening", { port: 3000 });
logger.warn("Slow response", { endpoint: "/users", timeMs: 1420 });
logger.error("Database connection failed", new Error("ECONNREFUSED"));

🧠 Smart Logging Examples

Log multiple arguments (like console.log)

logger.log("User login", userId, { role: "admin" });

Log objects safely (no crashes)

const obj = {};
obj.self = obj;
logger.info("Circular object test", obj);

Log errors with stack trace

try {
  throw new Error("Something went wrong");
} catch (err) {
  logger.error("Unhandled error", err);
}

📁 Log Output Structure

HB Smart Logger automatically creates this structure:

logs/
  combined/
    combined-2026-01-05.log
  error/
    error-2026-01-05.log
  warn/
    warn-2026-01-05.log
  info/
    info-2026-01-05.log
  debug/
    debug-2026-01-05.log

📂 What Goes Where?

log() / info()
  logs/info/ + logs/combined/
warn()
  logs/warn/ + logs/combined/
error()
  logs/error/ + logs/combined/
debug()
  logs/debug/ + logs/combined/

🔄 Log Rotation (Built-In)

📅 Daily rotation

📦 Max size: 10 MB per file

🗜️ Compressed archives

🧹 Auto-cleanup: keeps last 30 days

No extra setup required.

🧪 Environment Friendly

Works in development, staging, and production

Colorized console output for local development

File-based logging for production systems

🛠️ Use Cases

✔ REST APIs

✔ Express / Fastify servers

✔ Background workers

✔ Cron jobs

✔ Microservices

✔ Long-running Node.js services

🔥 Why HB Smart Logger?

| Feature | console.log | winston | HB Smart Logger | |--------|---------------|-----------|---------------------| | Daily log rotation | ❌ | ❌ | ✅ | | Circular JSON safe | ❌ | ❌ | ✅ | | Per-level log files | ❌ | ⚠️ | ✅ | | Combined log file | ❌ | ⚠️ | ✅ | | logger.log() alias | ❌ | ❌ | ✅ | | Multi-argument logging | ❌ | ❌ | ✅ | | Ready-to-use defaults | ❌ | ⚠️ | ✅ |

📌 Requirements

Node.js >= 14

CommonJS environment

🧭 Roadmap

Planned enhancements:

Configurable log directory

JSON-only output mode

Express request/response middleware

TypeScript typings

Cloud logging support (AWS / GCP)

📄 License

MIT © 2026 Hafiz Bilal