Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

micro-logs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-logs

A minimal, console-only logging utility that behaves exactly like logs-gateway console logging, with optional fail-fast error throwing.

latest
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

micro-logs

A minimal, console-only logging utility that behaves exactly like logs-gateway console logging, with optional fail-fast error throwing.

Features

  • Console-only: Zero support for files, transports, or complex routing.
  • Environment-driven: Configuration via environment variables.
  • Logs-gateway parity: Identical log-level semantics and behavior.
  • Fail-fast: Error logs throw by default (configurable).
  • Zero dependencies: Lightweight and predictable.

Installation

npm install micro-logs

Usage

import { Logger } from 'micro-logs';

const logger = new Logger({
  packageName: 'my-service',
  debugNamespace: 'api:v1' // Optional
});

logger.info('Server started');
logger.debug('Processing request'); // Suppressed by default
logger.error('Database connection failed'); // Throws by default

Configuration

Log Levels

Logs are filtered based on a minimum threshold. Supported levels (ordered):

  • verbose
  • debug
  • info (default)
  • warn
  • error

Configure via: {ENV_PREFIX}_LOG_LEVEL (e.g., LOG_LEVEL=debug).

DEBUG Namespace

Enable verbose and debug logs for specific namespaces without lowering the global level.

Configure via: DEBUG (e.g., DEBUG=api:*,auth).

Error Throwing

By default, calling logger.error() will throw an Error.

Configure via: {ENV_PREFIX}_THROW_ERROR (values: true | false).

License

ISC

FAQs

Package last updated on 20 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts