🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

obug

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obug

A lightweight JavaScript debugging utility, forked from debug, featuring TypeScript and ESM support.

latest
Source
npmnpm
Version
2.1.1
Version published
Weekly downloads
20M
-17.68%
Maintainers
1
Weekly downloads
 
Created
Source

obug

npm version npm downloads Unit Test

A lightweight JavaScript debugging utility, forked from debug, featuring TypeScript and ESM support.

[!NOTE] obug v1 retains most of the compatibility with debug, but drops support for older browsers and Node.js, making it a drop-in replacement.

obug v2 refactors some API imports and usage for better support of ESM and TypeScript, easier customization, and an even smaller package size.

Key Differences from debug

  • ✨ Minimal footprint
    • 7.7 kB package size
    • 1.4 KB minified + gzipped for browsers
  • 📦 Zero dependencies
  • 📝 Full TypeScript support
  • 🚀 Native ESM compatibility
  • 🌐 Optimized for modern runtimes
    • ES2015+ browsers
    • Modern Node.js versions
  • 🎨 Customizable formatting

Installation

npm install obug

Usage

import { createDebug, disable, enable, enabled, namespaces } from 'obug'

// Get the currently enabled namespaces
console.log(namespaces())

const debug = createDebug('my-namespace', {
  // All options are optional

  useColors: true, // false, true, undefined for auto-detect
  color: 2, // custom color
  // custom formatArgs
  formatArgs(args) {},
  formatters: {},
  // Node.js only
  inspectOpts: {},

  // custom log
  log: console.log,
})

debug('This is a debug message')
console.log(
  debug.namespace, // 'my-namespace'
  debug.enabled, // Check if enabled
  debug.useColors, // true
  debug.color, // 2
  debug.formatArgs, // custom formatArgs
  debug.formatters, // {}
  debug.inspectOpts, // {}
  debug.log, // implemented log function
)

// Create a sub-namespace, and it will inherit options from the parent debugger
const sub = debug.extend('sub-namespace')
sub('This is a sub-namespace debug message')
console.log(sub.namespace) // 'my-namespace:sub-namespace'

Original Authors

As obug is a fork of debug with significant modifications, we would like to acknowledge the original authors:

  • TJ Holowaychuk
  • Nathan Rajlich
  • Andrew Rhyne
  • Josh Junon

Sponsors

License

MIT License © 2025-PRESENT Kevin Deng

The MIT License Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>

The MIT License Copyright (c) 2018-2021 Josh Junon

FAQs

Package last updated on 22 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts