initLogger method
Initialize the command with a logger instance.
Must be called before using any logger methods.
Parameters:
jsonOutput: If true, configures logger for JSON outputuseColors: If true, enables colored terminal output
Example:
final command = MyCommand();
command.initLogger(jsonOutput: false, useColors: true);
await command.execute();
Implementation
void initLogger({bool jsonOutput = false, bool useColors = true}) {
_jsonOutput = jsonOutput;
_useColors = useColors;
_logger = Logger(
level: jsonOutput ? Level.error : Level.info,
);
}