Modifying the Logger

The CodenicLogger is an extension of the logger package. This means that it has same parameters as its parent, specifically the LogLevel, LogFilter, and LogOutput. These parameters can be modified when the CodenicLogger is instantiated.

With regards to the printer, the CodenicLogger can only accept a special printer called MessageLogPrinter which enforces a fixed structure for the printed logs.


final codenicLogger = CodenicLogger(
  filter: null, // Use the default LogFilter (-> only log in debug mode)
  output: null, // Use the default LogOutput (-> send everything to console)
  printer: MessageLogPrinter(
    methodCount: 2, // number of method calls to be displayed
    errorMethodCount: 8, // number of method calls if stacktrace is provided
    lineLength: 120, // width of the output
    colors: true, // Colorful log messages
    printEmojis: true, // Print an emoji for each log message
    printTime: false // Should each log print contain a timestamp
    stackTraceBlocklist: [ // Blocklists the stack trace lines that matches any of the regex

Last updated