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

@breadstone/ziegel-platform-logging

v0.0.9

Published

Includes logging functions for logging different states or types.

Readme

@breadstone/ziegel-platform-logging

MIT License TypeScript npm

Enterprise logging and diagnostics infrastructure for the ziegel platform. Provides structured logging, multiple appenders, log levels, correlation tracking, and centralized log management for distributed applications.

Logging: Enterprise-grade logging with structured output, correlation tracking, and centralized management.

🚀 Overview

@breadstone/ziegel-platform-logging provides:

  • Structured Logging: JSON-formatted logs with metadata
  • Multiple Appenders: Console, file, database, and remote logging
  • Log Levels: Configurable logging levels and filtering
  • Correlation Tracking: Request correlation and distributed tracing
  • Performance Logging: Method execution and performance tracking
  • Log Aggregation: Centralized log collection and analysis
  • Security Logging: Audit trails and security event logging

📦 Installation

npm install @breadstone/ziegel-platform-logging
# or
yarn add @breadstone/ziegel-platform-logging

🧩 Features & Usage Examples

Basic Logging

import { Logger, LoggerFactory } from '@breadstone/ziegel-platform-logging';

const logger = LoggerFactory.getLogger('MyService');

// Different log levels
logger.debug('Debug information', { userId: '123' });
logger.info('User logged in', { userId: '123', ip: '192.168.1.1' });
logger.warn('Rate limit exceeded', { userId: '123', attempts: 5 });
logger.error('Database connection failed', { error: 'Connection timeout' });

Structured Logging

import { StructuredLogger, LogContext } from '@breadstone/ziegel-platform-logging';

const logger = new StructuredLogger('OrderService');

// Log with structured data
logger.info('Order created', {
  orderId: 'ORD-123',
  customerId: 'CUST-456',
  amount: 99.99,
  items: [
    { sku: 'ITEM-1', quantity: 2 },
    { sku: 'ITEM-2', quantity: 1 }
  ]
});

Log Configuration

import { LoggerConfiguration, ConsoleAppender, FileAppender } from '@breadstone/ziegel-platform-logging';

const config = new LoggerConfiguration()
  .setLevel('info')
  .addAppender(new ConsoleAppender({
    format: 'json',
    colorize: true
  }))
  .addAppender(new FileAppender({
    filename: 'logs/app.log',
    maxSize: '10MB',
    maxFiles: 5,
    compress: true
  }));

LoggerFactory.configure(config);

Correlation Tracking

import { CorrelationContext, CorrelationMiddleware } from '@breadstone/ziegel-platform-logging';

// Express middleware for correlation tracking
app.use(CorrelationMiddleware());

// Use correlation in services
class UserService {
  private logger = LoggerFactory.getLogger('UserService');
  
  async getUser(id: string) {
    const correlationId = CorrelationContext.getId();
    this.logger.info('Fetching user', { 
      userId: id, 
      correlationId 
    });
    
    // All logs in this request will have the same correlationId
    return await this.userRepository.findById(id);
  }
}

Performance Logging

import { PerformanceLogger, LogPerformance } from '@breadstone/ziegel-platform-logging';

class DatabaseService {
  private logger = LoggerFactory.getLogger('DatabaseService');
  
  @LogPerformance()
  async executeQuery(sql: string): Promise<any[]> {
    // Method execution time will be automatically logged
    return await this.database.query(sql);
  }
  
  async manualTiming() {
    const timer = this.logger.startTimer();
    
    // Perform operation
    await this.heavyOperation();
    
    timer.done('Heavy operation completed');
  }
}

Custom Appenders

import { LogAppender, LogEntry } from '@breadstone/ziegel-platform-logging';

class ElasticsearchAppender implements LogAppender {
  constructor(private client: ElasticsearchClient) {}
  
  async write(entry: LogEntry): Promise<void> {
    await this.client.index({
      index: 'application-logs',
      body: {
        timestamp: entry.timestamp,
        level: entry.level,
        message: entry.message,
        data: entry.data,
        source: entry.source
      }
    });
  }
}

// Register custom appender
config.addAppender(new ElasticsearchAppender(esClient));

Security Logging

import { SecurityLogger, AuditLogger } from '@breadstone/ziegel-platform-logging';

const securityLogger = new SecurityLogger();
const auditLogger = new AuditLogger();

// Security events
securityLogger.logLoginAttempt({
  userId: '123',
  success: true,
  ip: '192.168.1.1',
  userAgent: 'Mozilla/5.0...'
});

securityLogger.logPermissionDenied({
  userId: '123',
  resource: '/admin/users',
  action: 'DELETE'
});

// Audit trail
auditLogger.logDataAccess({
  userId: '123',
  table: 'users',
  action: 'SELECT',
  recordCount: 150
});

Log Filtering and Sampling

import { LogFilter, SamplingFilter, RegexFilter } from '@breadstone/ziegel-platform-logging';

// Sample only 10% of debug logs
const samplingFilter = new SamplingFilter({
  level: 'debug',
  rate: 0.1
});

// Filter out sensitive data
const sensitiveFilter = new RegexFilter({
  pattern: /password|secret|token/i,
  replacement: '[REDACTED]'
});

config.addFilter(samplingFilter);
config.addFilter(sensitiveFilter);

📚 Package import points

import {
    // Core Logging
    Logger,
    LoggerFactory,
    StructuredLogger,
    LogLevel,
    
    // Configuration
    LoggerConfiguration,
    LogEntry,
    
    // Appenders
    ConsoleAppender,
    FileAppender,
    DatabaseAppender,
    RemoteAppender,
    
    // Correlation
    CorrelationContext,
    CorrelationMiddleware,
    
    // Performance
    PerformanceLogger,
    LogPerformance,
    
    // Security
    SecurityLogger,
    AuditLogger,
    
    // Filtering
    LogFilter,
    SamplingFilter,
    RegexFilter
} from '@breadstone/ziegel-platform-logging';

📚 API Documentation

For detailed API documentation, visit: API Docs

Related Packages

  • @breadstone/ziegel-platform: Core platform services
  • @breadstone/ziegel-platform-configuration: Configuration management
  • @breadstone/ziegel-core: Foundation utilities

License

MIT

Issues

Please report bugs and feature requests in the Issue Tracker


Part of the ziegel Enterprise TypeScript Framework