0.0.35 • Published 3 months ago

feature-logger v0.0.35

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

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."
0.0.33

4 months ago

0.0.34

3 months ago

0.0.35

3 months ago

0.0.30

4 months ago

0.0.31

4 months ago

0.0.32

4 months ago

0.0.29

5 months ago

0.0.27

6 months ago

0.0.28

6 months ago

0.0.26

6 months ago

0.0.25

7 months ago

0.0.24

8 months ago

0.0.21

10 months ago

0.0.22

10 months ago

0.0.23

9 months ago

0.0.20

10 months ago

0.0.19

11 months ago

0.0.18

11 months ago

0.0.13

12 months ago

0.0.14

12 months ago

0.0.15

12 months ago

0.0.16

12 months ago

0.0.17

12 months ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago