Socket
Book a DemoInstallSign in
Socket

feature-logger

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feature-logger

Straightforward, typesafe, and feature-based logging library

latest
Source
npmnpm
Version
0.0.45
Version published
Maintainers
1
Created
Source

feature-logger banner

GitHub License NPM bundle minzipped size NPM total downloads Join Discord

Status: Experimental

feature-logger is a straightforward, typesafe, and feature-based logging library.

  • Lightweight & Tree Shakable: Function-based and modular design (< 1KB minified)
  • Fast: Minimal code ensures high performance
  • Modular & Extendable: Easily extendable with features like withTimestamp(), withPrefix(), ..
  • Typesafe: Build with TypeScript for strong type safety
  • Standalone: Zero dependencies, ensuring ease of use in various environments

🌟 Motivation

Create a typesafe, straightforward, and lightweight logging library designed to be modular and extendable with features like withTimestamp(), withPrefix(), ..

⚖️ Alternatives

📖 Usage

import { createLogger } from 'feature-logger';

export const logger = createLogger();

logger.trace("I'm a trace message!");
logger.log("I'm a log message!");
logger.info("I'm a info message!");
logger.warn("I'm a warn message!");
logger.error("I'm a error message!");

📙 Features

withPrefix()

Adds a static prefix to all log messages, allowing for consistent and easily identifiable log entries.

import { createLogger, withPrefix } from 'feature-logger';

const logger = withPrefix(createLogger(), 'PREFIX');

logger.log('This is a log message.');
// Output: "PREFIX This is a log message."

withTimestamp()

Adds a timestamp to all log messages, enabling you to track when each log entry was created.

import { createLogger, withTimestamp } from 'feature-logger';

const logger = withTimestamp(createLogger());

logger.log('This is a log message.');
// Output: "[MM/DD/YYYY, HH:MM:SS AM/PM] This is a log message."

withMethodPrefix()

Adds the log method name as a prefix to all log messages, allowing you to easily identify the log level or method used.

import { createLogger, withMethodPrefix } from 'feature-logger';

const logger = withMethodPrefix(createLogger());

logger.log('This is a log message.');
// Output: "Log: This is a log message."

logger.error('This is an error message.');
// Output: "Error: This is an error message."

FAQs

Package last updated on 06 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