Logger.warn
Summary
The warn method formats a warning message with a yellow color and returns it along with any additional parameters.
Example Usage
javascript
import { Logger } from 'utility/Logger.js';
Logger.includeTrace = true; // optional for more information
const formattedWarnMessage = logger.warn("This is a warning message", {
additional: "info",
});
console.log(...formattedWarnMessage);Code Analysis
Inputs
message: The main warning message to format....optionalParams: Additional parameters to include with the formatted message.
Flow
- The method receives a
messageand any number ofoptionalParams. - It calls the
_formatMessagemethod with 'WARN' as the level and the providedmessage. - The formatted message is then colored yellow using
chalk.yellow. - The method returns an array containing the yellow-colored message and any
optionalParams.
Outputs
- An array containing the yellow-colored formatted warning message and any additional parameters.