feat(logs): log level, retention, size limits and rotation on server and desktop
Owner review 2, R11 asked for more log settings. The file sink now writes daily or hourly files, continues a full file in numbered parts and prunes by age and by the total size (never the file being written); its options change while it runs. Server: the file and console levels are separate and read by the logging filters at every line, so the admin panel's new Logs group applies without a restart; the engine's level follows the lower of the two. This also fixes a bug: the file logger was fixed at Information, so CHRONOS_LOG_LEVEL=Debug or Trace never reached the files. New variables CHRONOS_LOG_CONSOLE_LEVEL, CHRONOS_LOG_RETENTION_DAYS, CHRONOS_LOG_MAX_FILE_MB, CHRONOS_LOG_MAX_TOTAL_MB, CHRONOS_LOG_ROTATION, CHRONOS_AUDIT_RETENTION_DAYS and CHRONOS_DIAGNOSTICS_LOG_MB lock their settings like the others; the diagnostics zip keeps the configured share of each log. Desktop: Settings > Advanced gains Log level, Keep logs, File size, Logs total, Rotation and Diagnostics logs, applied at every save; Advanced's Reset section restores them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit cc875784e4952ee0e4c807b9d9c18496d3d5a8c3)
This commit is contained in:
1 parent
1f089888e8
commit
0e84392f4f
35 files changed
+1485
-119
No files matched your search
@@ -6,7 +6,8 @@ namespace Chronos.Protocol;
|
||||
/// that saved values (ports, TLS, chunk size, job history) wait for a restart. <see cref="ProxyWarning"/> is set in
|
||||
/// responses when TLS mode is proxy and the request did not come through a trusted proxy over HTTPS (ignored when saving).
|
||||
/// <see cref="Parallelism"/> is how many photos the running job processes at once (jobs run one at a time), and
|
||||
/// <see cref="PriorityQueue"/> with <see cref="JobPriorities"/> the priority queue (owner review 1); both apply at once.
|
||||
/// <see cref="PriorityQueue"/> with <see cref="JobPriorities"/> the priority queue (owner review 1); both apply at once, as
|
||||
/// do <see cref="Logs"/> (owner review 2, R11; a request without them keeps them as they are).
|
||||
/// </summary>
|
||||
public sealed record ServerSettingsDto(
|
||||
string ServerName,
|
||||
@@ -25,10 +26,30 @@ public sealed record ServerSettingsDto(
|
||||
int JobHistoryDays,
|
||||
int TokenLifetimeDays,
|
||||
int UploadRetentionHours,
|
||||
LogSettingsDto Logs,
|
||||
IReadOnlyList<string> Locked,
|
||||
bool RestartRequired,
|
||||
bool ProxyWarning);
|
||||
|
||||
/// <summary>
|
||||
/// The log settings of <see cref="ServerSettingsDto"/> (owner review 2, R11): the least severe level of the files and of the
|
||||
/// console (<c>trace</c>, <c>debug</c>, <c>information</c>, <c>warning</c>, <c>error</c>, <c>critical</c>, <c>none</c>), the
|
||||
/// days log files are kept, the size at which a file continues in a numbered one and the size of all of them (MB of 2²⁰
|
||||
/// bytes, 0 = no limit), the rotation (<c>daily</c> or <c>hourly</c>, UTC), the days audit entries are kept (0 = forever)
|
||||
/// and the MB of the end of each log file in the diagnostics zip. Their locks use the server.json names (<c>LogLevel</c>,
|
||||
/// <c>ConsoleLogLevel</c>, <c>LogRetentionDays</c>, <c>LogMaxFileMb</c>, <c>LogMaxTotalMb</c>, <c>LogRotation</c>,
|
||||
/// <c>AuditRetentionDays</c>, <c>DiagnosticsLogMb</c>).
|
||||
/// </summary>
|
||||
public sealed record LogSettingsDto(
|
||||
string FileLevel,
|
||||
string ConsoleLevel,
|
||||
int RetentionDays,
|
||||
int MaxFileMb,
|
||||
int MaxTotalMb,
|
||||
string Rotation,
|
||||
int AuditRetentionDays,
|
||||
int DiagnosticsLogMb);
|
||||
|
||||
/// <summary>A kind of job (<c>render</c>) and its level in the server's priority queue: <c>high</c>, <c>normal</c> or <c>low</c>.</summary>
|
||||
public sealed record JobPriorityDto(string Kind, string Level);
|
||||
|
||||
|
||||
Reference in new issue
Block a user