mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
logging: limit main log file size to 100mb
This commit is contained in:
parent
19464ec080
commit
25cf7fde10
2 changed files with 5 additions and 3 deletions
|
|
@ -198,9 +198,10 @@ namespace Dalamud.Injector
|
||||||
|
|
||||||
CullLogFile(logPath, 1 * 1024 * 1024);
|
CullLogFile(logPath, 1 * 1024 * 1024);
|
||||||
|
|
||||||
|
const long maxLogSize = 100 * 1024 * 1024; // 100MB
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.WriteTo.Console(standardErrorFromLevel: LogEventLevel.Debug)
|
.WriteTo.Console(standardErrorFromLevel: LogEventLevel.Debug)
|
||||||
.WriteTo.File(logPath, fileSizeLimitBytes: null)
|
.WriteTo.File(logPath, fileSizeLimitBytes: maxLogSize)
|
||||||
.MinimumLevel.ControlledBy(levelSwitch)
|
.MinimumLevel.ControlledBy(levelSwitch)
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,15 +107,16 @@ public sealed class EntryPoint
|
||||||
.WriteTo.Sink(SerilogEventSink.Instance)
|
.WriteTo.Sink(SerilogEventSink.Instance)
|
||||||
.MinimumLevel.ControlledBy(LogLevelSwitch);
|
.MinimumLevel.ControlledBy(LogLevelSwitch);
|
||||||
|
|
||||||
|
const long maxLogSize = 100 * 1024 * 1024; // 100MB
|
||||||
if (logSynchronously)
|
if (logSynchronously)
|
||||||
{
|
{
|
||||||
config = config.WriteTo.File(logPath.FullName, fileSizeLimitBytes: null);
|
config = config.WriteTo.File(logPath.FullName, fileSizeLimitBytes: maxLogSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
config = config.WriteTo.Async(a => a.File(
|
config = config.WriteTo.Async(a => a.File(
|
||||||
logPath.FullName,
|
logPath.FullName,
|
||||||
fileSizeLimitBytes: null,
|
fileSizeLimitBytes: maxLogSize,
|
||||||
buffered: false,
|
buffered: false,
|
||||||
flushToDiskInterval: TimeSpan.FromSeconds(1)));
|
flushToDiskInterval: TimeSpan.FromSeconds(1)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue