Skip to content


Logging is vital for tracking the behavior and states of software. In the CatLog namespace, you have classes dedicated to representing, capturing, and serializing object states during the logging process.

Object States

The ObjectStates class provides a snapshot of an object's state during a log event. Object states are saved to the Logs/States directory by default. However, you can customize this path by adjusting the LogSettings.FileSettings.ObjectStatesDirectory property.

While the default serialization format is JSON, if you wish to use a different format, you can inherit from the serializer class and modify the serializer setting in LogSettings. Ensure that the object is JSON-serializable. If not, either implement a custom serializer for the object or convert it to a serializable data type before logging.


  • TimeStamp: Represents the exact time when the state was captured.
  • Message: An optional message associated with the current state.
  • State: Represents the captured object's state.
  • StackTrace: An associated stack trace, formatted for ease of reading.


When a specific state of an object needs to be logged, an instance of ObjectStates can be initialized, capturing the current state and any associated (optional) stack trace.

var objState = new ObjectStates(myObject, new StackTrace());


JsonStateSerializer provides functionalities to serialize the state of a log object into a JSON format. This is particularly useful for persisting object states to disk or other storage mediums.


  • settings: Contains the JSON serialization settings used internally.


The JsonStateSerializer can be used to serialize a log's state, providing a robust and readable snapshot of that log event.

var serializer = new JsonStateSerializer();