JSPM

@endylus/logger

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q46770F
  • License ISC

It enables logging into the local directory.

Package Exports

  • @endylus/logger
  • @endylus/logger/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@endylus/logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Logger

Logger is a versatile logging module for Node.js applications, providing both console and file logging capabilities with customizable options.

npm install @endylus/logger

Features

  • Console and File Logging: Logs can be outputted to the console and/or stored in files.
  • Customizable Options: Various options such as log folder path, console logging, and file logging can be configured.
  • Multiple Logging Levels: Supports different logging levels (INFO, ERROR, WARN, DEBUG) for different types of messages.

Usage

const Logger = require('@endylus/logger');

// Create a new instance of Logger with optional configuration options
const log = new Logger({
    consoleLog: true, // Enable console logging (Default: true)
    filesLog: true, // Enable file logging (Default: true)
    logFolderPath: './logs' // Log files directory path (Default: './logs')
});

// Log messages with different levels
log.info('This is an information message.');
log.error('This is an error message.');
log.warn('This is a warning message.');
log.debug('This is a debugging message.');

/*
Output:
[15:13:43] [INFO] This is an info log
[15:13:43] [ERROR] This is an error log
[15:13:43] [WARN] This is a warn log
[15:13:43] [DEBUG] This is a debug log
*/