Skip to content


File-based logging is an essential component for any significant game or application, serving as a vital tool for maintaining a permanent record of events and activities. With Cobra Logging's enhanced FileSettings, managing and controlling the storage of logs as files has become more efficient and customizable, ideal for archiving, analyzing, or sharing logs.

The FileSettings class, part of the ByteCobra.Logging.Settings namespace, provides a comprehensive set of configuration options to tailor your logging needs.

File Size Restrictions

  • MaxFileSize: Specifies the maximum allowed size for individual log files. Default: 100 MB. This limit ensures efficient management of disk space.
  • MaxStateDirectorySize: Determines the size cap for the directory holding serialized object states. Default: 100 MB. This helps in managing the storage space more effectively.

Directory Management

  • LogFilesDirectory: Designates the storage location for your log files. Updating this setting automatically links it with the provided filename, making management simpler.
  • StatesDirectory: Identifies the directory for storing serialized object states. Default: Logs/States. This centralizes the storage of object states for easier access and organization.

Logging Preferences

Configure what types of logs are stored:

  • SaveLogs: Enables or disables saving all log messages to files.
  • SaveStates: Toggles the saving of serialized object states.
  • FileName: Determines the filename for stored log messages. Default: Logs.txt. This offers flexibility in naming log files for better organization.

The FileSettings class, as defined in the ByteCobra.Logging.Settings namespace, includes properties like MaxFileSize, MaxStateDirectorySize, LogFilesDirectory, and StatesDirectory. These properties allow for detailed customization of log file behavior, including file size limits, storage locations, and whether to save all logs and states. The addition of the FileName property provides further control over log file management, ensuring that logs are not only captured but also organized in a user-friendly manner.