🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@nldoc/logger

Package Overview
Dependencies
Maintainers
3
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nldoc/logger

A logger package that handles logging in ECS format. Based on Pino.

latest
npmnpm
Version
1.1.81
Version published
Weekly downloads
89
584.62%
Maintainers
3
Weekly downloads
 
Created
Source

NLdoc TypeScript Logger

pipeline status coverage report Latest Release NPM Version

A TypeScript logger package that provides structured logging in ECS (Elastic Common Schema) format. Built on top of Pino for high-performance logging with environment-configurable settings.

Overview

This logger provides:

  • ECS-formatted structured logging for better log analysis
  • Environment-based configuration (logging enabled/disabled, trace levels)
  • Built-in metadata injection (logger version, environment, Node.js version)
  • TypeScript support with full type safety
  • High-performance logging through Pino

Getting Started

Prerequisites

  • Node.js >= 22

Installation

Install the package via npm:

npm install @nldoc/logger

Basic Usage

import { logger } from '@nldoc/logger';

// Simple logging
logger.info('Application started');

// Structured logging with additional context
logger.child({ userId: '123', module: 'auth' }).info('User logged in');

// Different log levels
logger.debug('Debug information');
logger.warn('Warning message');
logger.error('Error occurred');

Configuration

The logger can be configured through environment variables:

  • LOGGING_ENABLED (default: true) - Enable/disable logging
  • TRACE_ENABLED (default: false) - Enable trace-level logging
  • ENVIRONMENT (default: development) - Environment identifier
  • NODE_VERSION - Node.js version (automatically injected into logs)

Development

Local Setup

  • Clone the repository:

    git clone https://gitlab.com/logius/nldoc/lib/typescript/logger.git
    cd typescript-logger
    
  • Install dependencies:

    npm install
    
  • Build the project:

    npm run build
    

Available Scripts

  • npm run test - Run the test suite with coverage
  • npm run build - Build TypeScript to JavaScript
  • npm run check - Type-check without emitting files
  • npm run lint - Lint the codebase
  • npm run format - Format code using Prettier
  • npm run fix - Auto-fix linting and formatting issues

API Documentation

For detailed Pino API documentation, see the official Pino documentation.

Testing

Run the test suite:

npm test

Contributing

We welcome contributions! Please ensure:

  • All tests pass (npm test)
  • Code is properly formatted (npm run format:check)
  • Linting rules are followed (npm run lint)
  • Type checking passes (npm run check)

License

This project is licensed under the European Union Public License 1.2 - see LICENSE for details.

Acknowledgements

FAQs

Package last updated on 24 Nov 2025

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