Module: utils/logUtil

Logging Utility for Satoshi Showdown. This module configures and provides a logging utility for the application, utilizing the Winston library. It defines custom logging levels, formats, and sets up transports for outputting logs. The custom format combines timestamps and message content for clarity. The logger also provides a stream for integrating with middleware like morgan to facilitate logging HTTP requests and responses.

The logger can be easily extended by adding additional transports, such as file transport, for different log output needs. The utility is designed to be modular and flexible, suitable for use across different parts of the application.

Source:

Requires

  • module:winston

Members

(inner, constant) log :winston.Logger

Creates and configures a Winston logger instance. The logger is configured with the specified levels, format, and transports to ensure consistent and effective logging across the application. The log level can be dynamically set using environment variables, allowing for easy adjustment in different environments.

Type:
  • winston.Logger
Source:

(inner, constant) logFormat :winston.Logform.Format

Custom log format. This format enhances log readability by combining a timestamp indicating the time of log generation and a printf format for displaying the log level and message content.

Type:
  • winston.Logform.Format
Source:

(inner, constant) logLevels :Object

Custom logging levels for the application. These levels define the severity of log messages and allow for filtering based on importance and type. The structure follows a hierarchy where each level includes the levels above it (error includes warn, info includes http, etc.).

Type:
  • Object
Source:

(inner, constant) logTransports :Array.<winston.transport>

Transport mechanisms for logging. Defines how logs are outputted. By default, logs are written to the console, but this array can be expanded to include file transports or other means of logging, catering to various environments and requirements.

Type:
  • Array.<winston.transport>
Source: