Configuration
Configure Logix using the fluent API or a ScriptableObject asset.
Fluent API
Log.WithOptions(o =>
{
o.MinLogLevel = LogLevel.Warning;
o.EnableTimestamps = true;
o.EnableFileLogging = true;
o.LogFilePath = "Logs/Game.log";
o.MaxLogFileSize = 50L * 1024 * 1024;
o.TimeoutSeconds = 5;
});
Log.Container.AddSink(new UnityLogSink());
Log.Container.AddSink(new FileLogSink("Game.log"));
Log.Container.AddFilter(new LevelFilter(LogLevel.Warning));
Options
| Option | Default | Description |
|---|---|---|
MinLogLevel |
Debug |
Minimum level to process |
EnableTimestamps |
true |
Include timestamp in output |
EnableFileLogging |
false |
Auto-add a FileLogSink |
LogFilePath |
"Logs.txt" |
Path for the file sink |
MaxLogFileSize |
50 MB | Auto-rotate threshold |
TimeoutSeconds |
5 |
Semaphore acquire timeout |
ScriptableObject
Create a LogixOptions asset (Assets / Create / Logix / LogixOptions) and load it:
var settings = Resources.Load<LogixOptionsSO>("MyLogixSettings");
Log.WithScriptableObject(settings);
The Unity initializer loads LogixRuntimeSettings.asset from Resources automatically.