0.11.0 • Published 2 months ago

@armscye/logging v0.11.0

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

@armscye/logging

A collection of shared standard TypeScript definitions (@logging).

Installation

Using npm:

npm install --save-dev @armscye/logging

or using yarn:

yarn add @armscye/logging --dev

Reference

Logger Interface

Describes a common interface for logging.

interface Logger {
  trace(msg: any, ...args: unknown[]): any;

  debug(msg: any, ...args: unknown[]): any;

  info(msg: any, ...args: unknown[]): any;

  warn(msg: any, ...args: unknown[]): any;

  error(msg: any, ...args: unknown[]): any;
}

The interface offers various methods for logging messages at different levels of severity:

  • trace: Log a message at the TRACE level.
  • debug: Log a message at the DEBUG level.
  • info: Log a message at the INFO level.
  • warn: Log a message at the WARN level.
  • error: Log a message at the ERROR level.

Each method takes the message, usually a string, as the first argument and allows additional arguments for providing context (variables, objects, etc.).

Usage notes

Here's an example demonstrating how to use the Logger interface:

class MyLogger implements Logger {}

const logger = new MyLogger();

logger.info('Starting service processing...');

try {
  // ... service logic
} catch (error) {
  logger.error('An error occurred:', error);
}

logger.info('Service processing completed.');

License

This project is licensed under the MIT license.

See LICENSE for more information.

0.11.0

2 months ago

0.10.0

3 months ago

0.9.0

3 months ago

0.8.0

3 months ago

0.7.0

3 months ago

0.6.0

3 months ago

0.5.0

3 months ago

0.4.0

3 months ago

0.3.0

5 months ago

0.2.0

5 months ago

0.1.0

6 months ago