1.0.0 • Published 8 months ago

@swiftpost/logger v1.0.0

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

@swiftpost/logger

A simple console logger with colors.

Installation

pnpm add @swiftpost/logger

Usage

import { Logger } from "@swiftpost/logger";

const logger = new Logger();

Scoping

You can scope the logger to a specific module or feature.

const logger = new Logger({ scope: "auth" });

Methods

info(message: string, ...args: any[])

Log an info message.

logger.info("This is an info message");
output

12:00:00 INFO auth: This is an info message

warn(message: string, ...args: any[])

Log a warning message.

logger.warn("This is a warning message");
output

12:00:00 WARN auth: This is a warning message

error(message: string, ...args: any[])

Log an error message.

logger.error("This is an error message");
output

12:00:00 ERROR auth: This is an error message

debug(message: string, ...args: any[])

Log a debug message.

logger.debug("This is a debug message");
output

12:00:00 DEBUG auth: This is a debug message

1.0.0

8 months ago