init method

Future<void> init()
inherited

Implementation

Future<void> init() async {
  final bool allowColors = colorArg.parse(argResults);
  Trace.toggleAnsiFormatting(allowColors);

  final BaseRunner cliRunner = runner as BaseRunner;
  final LogFilter logFilter =
      filter ?? DefaultLogFilter(logLevel, debugOnly: false);

  Trace.registerLoggers(
    <Logger>[
      ConsoleLogger(
        level: logLevel,
        ioSink: cliRunner.sink,
        theme: cliRunner.loggerTheme,
        filter: logFilter,
        allowAnsi: allowColors,
      ),
      if (logsDirectory != null)
        FileLogger(
          level: logLevel,
          theme: cliRunner.loggerTheme,
          path: logsDirectory?.path,
          filter: logFilter,
        ),
    ],
  );

  cliRunner.printLogo();

  Trace.printListItem('Running command: ${name.bold()}');
}