1.0.1 • Published 1 year ago

@opensource365/logging v1.0.1

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
1 year ago

@opensource365/logging

A lightweight and flexible logging library designed to simplify logging across applications. With minimal configuration, @opensource365/logging helps you efficiently log events, errors, and debug information, making it ideal for both small and large projects.

Features

  • Lightweight and Fast: Minimal performance impact.
  • Free and open-source: The library is under MIT license.
  • Easy Integration: Simple setup and configuration.
  • Flexible Logging Levels: Supports various logging levels (e.g., info, debug, error).
  • Consistent Logging Format: Provides a unified format for logs.
  • Customizable Output: Extendable to output logs in different formats (console, file, SharePoint List or custom).

Installation

Install the package via npm:

npm install @opensource365/logging

Usage

// By default, Logger uses console logging with a minimum level of Debug.
Logger.logInformation("This is an information message.");
Logger.logError("This is an error message.");
Logger.logWarning("This is a warning message.");
Logger.logDebug("This is a debug message.");

// You can add additional providers, such as a file provider.
const fileProvider: ILogProvider = {
    // Define your file logging implementation here
};
Logger.addProviders(fileProvider);

// Clear all providers (useful for production environments if you want no logging).
Logger.clearProviders();

// Re-add the console provider with a minimum log level (e.g., Error).
// Note: Clear default provider first if reconfiguration is needed.
Logger.clearProviders();
Logger.addConsole(LogLevel.Error);
1.0.1

1 year ago

1.0.0

1 year ago