enableFileOutput static method

LogError enableFileOutput({
  1. String logger = 'Main',
  2. bool exclusive = false,
  3. String? logFileName,
  4. bool append = false,
  5. bool flush = false,
  6. SaveFormat format = SaveFormat.text,
})

Enables file output for the specified logger.

  • logger: The logger name (defaults to "Main").
  • exclusive: If true, disables other outputs.
  • logFileName: Optional file name for the log file.
  • append: If true, appends to the file instead of overwriting.
  • format: The save format (defaults to SaveFormat.text).

Returns: A LogError indicating success or failure.

Implementation

static LogError enableFileOutput(
    {String logger = 'Main',
    bool exclusive = false,
    String? logFileName,
    bool append = false,
    bool flush = false,
    SaveFormat format = SaveFormat.text}) {
  return isCriticalMode
      ? LogError(-5, message: 'is in critical mode')
      : loggerManager.enableFileOutput(
          logger: logger,
          exclusive: exclusive,
          logFileName: logFileName,
          append: append,
          flush: flush,
          format: format);
}