Skip to content

Logger Configuration

Raphael Winkler edited this page May 29, 2022 · 3 revisions

Configuration

The Logger class exposes some property fields which can be set:

  • AttachedConsole (IConsole): See Additional features - IConsole interface. Default: null
  • DisableLogging (bool): Disable logging altogether when set to true. Default: false
  • LogToAttachedConsole (bool): Log entries are additionally logged to an attached console (if any is attached). Default: true
  • AddIdentifierToConsole (bool): Should prefixes like [INF], [DBG], etc be attached to strings logged to the attached console? Default: false

Also the static class "LoggerSettings" exposes multiple fields, which control identifier tags, timestamp format, etc:

  • IDENTIFIER_INFO: The string representation of "LogType.INFO". Default: "[ INF ]"
  • IDENTIFIER_WARN: The string representation of "LogType.WARN". Default: "[ WRN ]"
  • IDENTIFIER_ERROR: The string representation of "LogType.ERROR". Default: "[ ERR ]"
  • IDENTIFIER_FATAL: The string representation of "LogType.FATAL". Default: "[ FAT ]"
  • IDENTIFIER_DEBUG: The string representation of "LogType.DEBUG". Default: "[ DBG ]"
  • IDENTIFIER_VERBOSE: The string representation of "LogType.VERBOSE". Default: "[ VRB ]"
  • IDENTIFIER_CONSOLE: The string representation of "LogType.CONSOLE". Default: "[ CON ]"
  • TIMESTAMP_FORMAT_DATE: How the date in a log line should be represented. (see DateTime.ToString() format Default: "dd.MM.yyyy"
  • TIMESTAMP_FORMAT_TIME: How the time in a log line should be represented. (see DateTime.ToString() format Default: "HH:mm:ss.fff"
  • TIMESTAMP_FORMAT_SEPARATOR: The separator used between date and time in a log line. Default: "-"
  • SHOW_LOG_NAME: Affects only output to AttachedConsole! Controls if the file name should be printed before the log line if not the primary logger

Next up: Additional features