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

@evdy-consumer/dailyom-suite-logging

v0.0.7

Published

This library was generated with Nx.

Readme

DailyOM Logging Library

This library was generated with Nx.

The logging library provides a unified logging solution for Next.js and backend systems in the DailyOM Suite monorepo. It implements distributed tracing through trace and span IDs, allowing for correlation of logs across service boundaries

Features

  • Trace Context Management: Automatic generation and propagation of trace and span IDs
  • Hierarchical Spans: Create child spans for tracking operations within a request
  • Configurable Output: Log to console, files, or both
  • Daily Log Rotation: Automated log file rotation with size thresholds
  • Context Preservation: Maintains trace context across asynchronous operations using AsyncLocalStorage

Usage

Basic Logging

import { TracedLogger } from '@dailyom-suite/logging';

// Create a logger instance
const logger = new TracedLogger({
  name: 'my-service',
  level: 'info',           // Optional: default is 'info'
  logToConsole: true,      // Optional: default is true
  logToFile: true,         // Optional: default is true
  fileName: 'app-name.log' // Optional: default uses name + timestamp
});

// Log messages with context
logger.info({ userId: '123' }, 'User logged in');
logger.error({ orderId: '456' }, 'Failed to process order');

Trace Context and Spans

// Create a traced operation
logger.withSpan('database-query', () => {
  // All logs in this function will share the same trace context
  logger.debug({ query: 'SELECT * FROM users' }, 'Executing query');
  // ...
  return result;
});

// For async operations
await logger.withSpanAsync('api-request', async () => {
  logger.info({ url: '/api/data' }, 'Making API request');
  const response = await fetch('/api/data');
  logger.info({ status: response.status }, 'Received API response');
  return response.json();
});

Manual Trace Context Manipulation

import { 
  createTraceContext, 
  createChildSpan, 
  traceContextStorage 
} from '@dailyom-suite/logging';

// Create a new trace context
const context = createTraceContext();

// Create a child span from parent context
const childContext = createChildSpan(context);

// Run code with a specific trace context
traceContextStorage.run(context, () => {
  // All logs in this scope will use this context
});

Configuration

The library looks for the following environment variables:

  • LOG_DIR: Directory where log files will be stored (defaults to ./logs)

Log File Management

Log files follow this naming pattern:

{app-name}.{YYYY-MM-DD}.{HH-MM-SS}.log

Files rotate:

  • Every day (24 hours)
  • When they exceed 10MB in size

Building

Run nx build logging to build the library.

Running unit tests

Run nx test logging to execute the unit tests via Jest.

CI

PRs that contain changes to logging will run tests and builds to ensure project structure is adhered to