setDecoration static method

LogError setDecoration({
  1. String logger = 'Main',
  2. bool timeStamp = false,
  3. bool timeLine = false,
  4. bool loggerID = false,
  5. bool category = false,
  6. bool environment = false,
  7. String mode = 'none',
  8. String emoji = 'none',
  9. String colorPanel = 'none',
})

Configures the visual decoration and color scheme used for log output on the console.

This function allows you to customize how log messages appear for a specific logger by adjusting decoration style, display options, and color schemes.

  • logger: The name of the logger to configure (default: 'Main').
  • timeStamp: Whether to display the timestamp (default: true).
  • timeLine: Whether to display timeline information (default: true).
  • loggerID: Whether to display the logger ID (default: true).
  • category: Whether to display the category label (default: true).
  • mode: The decoration style to apply. Accepted values:
    • 'none': No decoration.
    • 'emoji': Adds emoji indicators per log level.
    • 'level': Shows log level names (e.g., INFO, ERROR).
    • 'simple': Minimal styling.
    • 'full': Displays all decoration elements.
    • emoji: a list of emojis, one per level in range, separated by commas.
    • colorPanel: A JSON string defining the color scheme.
    • 'none': Disables color output.
    • 'standard': Uses the built-in standard color palette.
    • Custom: A JSON map assigning ANSI codes or color names per log level:
      {
        "colorPanel": {
          "critical": "\u001B[31m",
          "info": "black",
          "debug": "blue"
        }
      }
      

Notes:

  • If either mode or colorPanel is set to 'none', the respective feature is disabled.
  • If the system is currently in critical mode, this call has no effect and returns an error.

Returns a LogError object indicating success or failure.

Implementation

static LogError setDecoration(
    {String logger = 'Main',
    bool timeStamp = false,
    bool timeLine = false,
    bool loggerID = false,
    bool category = false,
    bool environment = false,
    String mode = 'none',
    String emoji = 'none',
    String colorPanel = 'none'}) {
  return isCriticalMode
      ? LogError(-5, message: 'is in critical mode')
      : loggerManager.setDecoration(
          logger: logger,
          category: category,
          loggerID: loggerID,
          timeLine: timeLine,
          timeStamp: timeStamp,
          environment: environment,
          mode: mode,
          emoji: emoji,
          colorPanel: colorPanel);
}