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

@bernierllc/logging-core

v0.3.0

Published

Core logging interfaces and types for the Bernier LLC logging ecosystem

Readme

@bernierllc/logging-core

Core logging interfaces and types for the Bernier LLC logging ecosystem. This package provides the foundational types, interfaces, and utilities that other logging packages can build upon.

Features

  • Core Types: Log levels, entry types, and configuration interfaces
  • Logger Interfaces: Base logger, audit logger, and system logger interfaces
  • Transport Interfaces: Console, file, HTTP, and database transport definitions
  • Environment Detection: Utilities for detecting and configuring based on environment
  • Type Safety: Full TypeScript support with comprehensive type definitions
  • Zero Dependencies: Pure TypeScript with no external dependencies

Installation

npm install @bernierllc/logging-core

Usage

Basic Types

import { LogLevel, LogEntry, AuditLogEntry, SystemLogEntry } from '@bernierllc/logging-core';

// Log levels
const level: LogLevel = 'info';

// Base log entry
const entry: LogEntry = {
  level: 'info',
  message: 'Application started',
  timestamp: new Date().toISOString(),
  metadata: { userId: 'user123' }
};

// Audit log entry
const auditEntry: AuditLogEntry = {
  actorId: 'user123',
  action: 'LOGIN',
  target: 'auth-system',
  ip: '192.168.1.100'
};

// System log entry
const systemEntry: SystemLogEntry = {
  level: 'error',
  message: 'Database connection failed',
  error: new Error('Connection timeout'),
  timestamp: new Date().toISOString()
};

Logger Interfaces

import { ILogger, IAuditLogger, ISystemLogger } from '@bernierllc/logging-core';

// Base logger interface
const logger: ILogger = {
  log: (level, message, metadata) => { /* implementation */ },
  error: (message, error, metadata) => { /* implementation */ },
  warn: (message, metadata) => { /* implementation */ },
  info: (message, metadata) => { /* implementation */ },
  debug: (message, metadata) => { /* implementation */ }
};

// Audit logger interface
const auditLogger: IAuditLogger = {
  ...logger,
  logAudit: (entry) => { /* implementation */ }
};

// System logger interface
const systemLogger: ISystemLogger = {
  ...logger,
  logSystem: (entry) => { /* implementation */ }
};

Environment Detection

import { EnvironmentDetector } from '@bernierllc/logging-core';

// Get current environment
const env = EnvironmentDetector.getEnvironment(); // 'development' | 'staging' | 'production' | 'test'

// Environment checks
if (EnvironmentDetector.isProduction()) {
  // Production-specific logic
}

if (EnvironmentDetector.isDevelopment()) {
  // Development-specific logic
}

// Get environment defaults
const defaults = EnvironmentDetector.getEnvironmentDefaults();

Transport Interfaces

import { ITransport, ConsoleTransportConfig, FileTransportConfig } from '@bernierllc/logging-core';

// Transport interface
const transport: ITransport = {
  name: 'console',
  level: 'info',
  log: async (entry) => { /* implementation */ },
  close: async () => { /* implementation */ }
};

// Transport configurations
const consoleConfig: ConsoleTransportConfig = {
  level: 'debug',
  enableColors: true,
  enableTimestamps: true
};

const fileConfig: FileTransportConfig = {
  level: 'info',
  filePath: './logs/app.log',
  enableRotation: true,
  maxSize: '10m',
  maxFiles: '5'
};

API Reference

Types

LogLevel

type LogLevel = 'error' | 'warn' | 'info' | 'debug';

LogEntry

interface LogEntry {
  level: LogLevel;
  message: string;
  timestamp: string;
  metadata?: Record<string, unknown>;
  context?: string;
  requestId?: string;
  userId?: string;
}

AuditLogEntry

interface AuditLogEntry {
  actorId: string;
  action: string;
  target: string;
  ip?: string;
  metadata?: Record<string, unknown>;
  timestamp?: string;
  userId?: string;
  sessionId?: string;
  userAgent?: string;
  requestId?: string;
}

SystemLogEntry

interface SystemLogEntry extends LogEntry {
  error?: Error;
}

Interfaces

ILogger

Base logger interface with standard logging methods.

IAuditLogger

Extends ILogger with audit-specific logging capabilities.

ISystemLogger

Extends ILogger with system logging capabilities.

ITransport

Interface for different logging destinations (console, file, HTTP, etc.).

Utilities

EnvironmentDetector

Static class for environment detection and configuration.

Architecture

This package serves as the foundation for the logging ecosystem:

@bernierllc/logging-core (this package)
├── Types and interfaces
├── Environment detection
└── Transport definitions

@bernierllc/logging (service package)
├── Winston integration
├── File logging with rotation
└── Production-ready defaults

@bernierllc/logging-utils (util package)
├── Performance monitoring
├── Log analysis tools
└── Format converters

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

MIT License - see LICENSE file for details.