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

@budgetbuddyde/logger

v0.1.1

Published

![CI](https://ci.tklein.it/api/v1/teams/budgetbuddyde/pipelines/logger/jobs/build-logger/badge) ![NPM Version](https://img.shields.io/npm/v/%40budgetbuddyde%2Flogger) ![NPM License](https://img.shields.io/npm/l/%40budgetbuddyde%2Flogger) ![NPM Last Update

Readme

@budgetbuddyde/logger

CI NPM Version NPM License NPM Last Update

A collection of utility functions, configurations, and formatters for Winston loggers used within the BudgetBuddy project.

Features

  • Log Level Utilities: Helper functions for parsing and validating log levels from environment variables
  • Console Format Builder: Pre-configured Winston formatters for consistent console output
  • Level Padding: Formatting for uniform level output in logs
  • Level Configuration: Standardized log level configuration with colors for the entire project
  • TypeScript Support: Fully typed with comprehensive type definitions
  • Winston Integration: Seamless integration with Winston for all services and apps

Installation

npm install @budgetbuddyde/logger

Quick Start

Log Level from Environment Variables

import { getLogLevel } from '@budgetbuddyde/logger';

const logLevel = getLogLevel(process.env.LOG_LEVEL); // 'info', 'debug', 'warn', etc.

Winston Logger with Custom Format

import { createLogger, format } from 'winston';
import { buildConsoleFormat, padLevel, LevelConfig } from '@budgetbuddyde/logger';

export const logger = createLogger({
  levels: LevelConfig.levels,
  level: getLogLevel(process.env.LOG_LEVEL),
  format: format.combine(
    format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
    format.splat(),
    padLevel(5), // Pads level to 5 characters
    format.colorize({ level: true, colors: LevelConfig.colors }),
    buildConsoleFormat('MyService', false) // Show service name and meta
  ),
  transports: [new transports.Console()],
});

logger.info('Application started');
logger.warn('This is a warning');
logger.error('An error occurred');

Usage in the Project

The logger package is used across all services (Backend, Auth-Service) and apps (WebApp) in the BudgetBuddy project to ensure consistent logging configuration and formatting.

In the Backend Service

import { createLogger, format } from 'winston';
import { buildConsoleFormat, padLevel, LevelConfig } from '@budgetbuddyde/logger';

export const logger = createLogger({
  levels: LevelConfig.levels,
  level: config.log.level,
  format: format.combine(
    format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
    format.splat(),
    padLevel(5),
    format.colorize({ level: true, colors: LevelConfig.colors }),
    buildConsoleFormat(config.service, config.log.hideMeta)
  ),
  transports: config.log.transports,
});

In the WebApp

For the WebApp, a simplified version using direct createLogger from the package is used (if available), or Winston is configured directly.

API Reference

Log Levels

enum ELogLevel {
  SILENT = 'silent',
  DEBUG = 'debug',
  INFO = 'info',
  WARN = 'warn',
  ERROR = 'error',
  CRIT = 'crit',
}

type LogLevel = keyof typeof LevelConfig.levels;

Level Configuration

const LevelConfig = {
  levels: {
    silent: 6,
    debug: 5,
    info: 3,
    warn: 2,
    error: 1,
    crit: 0,
  },
  colors: {
    silent: 'gray',
    debug: 'blue',
    info: 'green',
    warn: 'yellow',
    error: 'red',
    crit: 'magenta',
  },
};

Utility Functions

getLogLevel(logLevel: string | undefined): LogLevel

Parses a log level from a string (e.g., environment variable) and returns a valid LogLevel.

const level = getLogLevel(process.env.LOG_LEVEL); // 'info' as fallback

buildConsoleFormat(fallbackLabel: string, hideMeta?: boolean)

Creates a Winston format for console output with timestamp, level, label, and optional metadata.

padLevel(whitespaceCount: number)

A Winston format transformer that pads log levels to a uniform length and converts them to uppercase.

Development

# Install dependencies
npm install

# Run tests
npm test

# Build package
npm run build

# Lint and format
npm run check

Dependencies

  • Winston: The package is designed as a peer dependency for Winston (^3.19.0) and provides utility functions for Winston loggers.