{"id":18508,"library":"log-bundler","title":"log-bundler","description":"A JavaScript/TypeScript library that collects multiple log messages and emits them as a single JSON log line. Version 0.5.4 is the latest stable release; the project is pre-1.0.0 with documentation promised at 1.0.0. It simplifies structured logging by buffering logs and flushing them as a batch, ideal for reducing I/O in high-throughput Node.js applications. Simpler than full-featured frameworks like Winston or Pino, but limited in features and currently lacks comprehensive docs.","status":"active","version":"0.5.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install log-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add log-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add log-bundler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library exports LogBundler as a named export. Default import is not supported.","wrong":"const LogBundler = require('log-bundler').LogBundler","symbol":"LogBundler","correct":"import { LogBundler } from 'log-bundler'"},{"note":"Helper function to create a LogBundler instance. Not a default export.","wrong":"const createLogBundler = require('log-bundler').default","symbol":"createLogBundler","correct":"import { createLogBundler } from 'log-bundler'"},{"note":"Type import available for TypeScript users. Avoid value import at runtime.","wrong":"import { LogBundlerOptions } from 'log-bundler' (when only type used)","symbol":"LogBundlerOptions","correct":"import type { LogBundlerOptions } from 'log-bundler'"}],"quickstart":{"code":"import { LogBundler } from 'log-bundler';\n\nconst bundler = new LogBundler({\n  batchSize: 10,\n  flushInterval: 1000,\n  level: 'info'\n});\n\nbundler.log('info', 'This is a log message', { userId: 123 });\nbundler.log('error', 'An error occurred', { errorCode: 500 });\n\n// Manually flush to write bundled logs\nbundler.flush();","lang":"typescript","description":"Show how to create a LogBundler, add individual logs, and flush them as a batch JSON log."},"warnings":[{"fix":"Pin to exact version or prepare for breaking changes.","message":"Pre-1.0.0 API may break in minor versions. Semantic versioning not guaranteed.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Use standard output streams instead of custom output file option.","message":"Certain configuration options (e.g., 'outputFile') may be removed in future releases.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Use 'await bundler.flush()' if flush() returns a promise.","message":"Calling flush() synchronously may emit logs asynchronously; ensure proper await if flush returns a promise.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Use 'import { LogBundler } from 'log-bundler'' or 'const { LogBundler } = require('log-bundler')'.","message":"Version 0.5.0 changed the export from default to named exports. 'require('log-bundler')' no longer returns a constructor.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Always use lowercase level strings.","message":"Log levels are case-sensitive and must be lowercase ('info', 'error'). Using uppercase 'INFO' will not filter correctly.","severity":"gotcha","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use named import: import { LogBundler } from 'log-bundler'","cause":"Using default import in ESM with older version (<0.5.0) or incorrect import style.","error":"TypeError: log_bundler_1.default is not a constructor"},{"fix":"Use import syntax or convert your project to ESM. Alternatively, for CommonJS, use dynamic import: const { LogBundler } = await import('log-bundler')","cause":"Using require() with an ESM-only package version.","error":"ERR_REQUIRE_ESM"},{"fix":"Run: npm install log-bundler","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'log-bundler'"},{"fix":"Instantiate LogBundler first: const bundler = new LogBundler(); then call bundler.log()","cause":"TypeScript not recognizing instance methods due to wrong import (importing the class instead of an instance).","error":"Property 'log' does not exist on type 'typeof import(...)'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}