Skip to content

Logger.log

Summary

The log method logs a message at the 'LOG' level to the console. It formats the message with a timestamp and optionally includes the function name or stack trace information.

Example Usage

javascript
import { Logger } from 'utility/Logger.js';

Logger.includeTrace = true; // optional for more information

Logger.log("This is a log message", { additional: "info" });

Code Analysis

Inputs

  • message: The main message to log (string).
  • ...optionalParams: Additional parameters to log (any type).

Flow

  1. The method receives a message and any number of optionalParams.
  2. It calls the _formatMessage method with 'LOG' as the level and the message to format the log entry.
  3. The formatted message is then logged to the console using console.log.
  4. Any optionalParams are also passed to console.log.

Outputs

  • Logs a formatted message to the console.