Skip to content


When it comes to logs, presentation matters. Whether it's for an editor's immediate view or long-term archival, the manner in which logs are formatted greatly impacts readability and clarity. With Cobra Logging's FormatSettings, developers can stylize and dictate how each log message should appear.

Located within the ByteCobra.Logging.Settings namespace, the FormatSettings class offers a suite of tools to format log messages.

Default Formatting

DefaultFormat: Represents the standard way in which log messages should be formatted. It's flexible and adjusts based on the environment.

  • If in the editor: Log messages are colorized using the tag.
  • Otherwise: Logs feature a timestamp, tag, and file details.
// In-editor format:
<color={log.Color}> {log.Tag} {log.FileInfo.Name}[{log.Line}]</color>: {log.OriginalMessage}

// Standard format:
[{log.Time.ToString(LogSettings.TimeFormat)}] {log.Tag} {log.FileInfo.Name}[{log.Line}]: {log.OriginalMessage}

Specific Log Formats

While there's a default format provided, you may wish to customize the presentation based on the log's nature.

  • DebugFormat: Personalize the presentation of debug logs.
  • InfoFormat: Style informational logs uniquely.
  • WarningFormat: Highlight warning logs with a distinct format.
  • AssertFormat: Ensure assert logs stand out with a tailored format.
  • ErrorFormat: Draw attention with a specialized format for error logs.
  • FatalFormat: Make fatal logs noticeable with a distinctive style.

Concluding Thoughts

How logs are presented plays a pivotal role in understanding them. A well-formatted log can convey vital information efficiently, while a poorly formatted one can lead to confusion or oversight. Cobra Logging's FormatSettings ensures that developers are equipped with the tools needed to make logs as informative and readable as possible. Remember, it's not just about logging information; it's about conveying it effectively!