Class LogFiles
Session log files: naming, pruning, listing and parsing the format written by FileLoggerProvider.
Namespace: Uniform.Matrix.Hosting
Assembly: Uniform.Matrix.Hosting.dll
public static class LogFiles
Fields
|
Edit this page
View Source
Name of a program's session logs when it gives none.
Declaration
public const string DefaultName = "client"
Field Value
Methods
|
Edit this page
View Source
Return a new file path for a session starting at started, e.g. logs/client-20261026-010536.log, named by name, such as server.
Declaration
public static string CreateSessionPath(string directory, DateTime started, string name = "client")
Parameters
Returns
|
Edit this page
View Source
List session logs newest first, then the single log of older versions at legacyPath when it exists.
Declaration
public static IReadOnlyList<LogFileInfo> List(string directory, string? legacyPath = null)
Parameters
Returns
|
Edit this page
View Source
Group lines into entries: a line starting with time and level begins one, other lines continue it.
Declaration
public static IReadOnlyList<LogEntry> Parse(IEnumerable<string> lines)
Parameters
Returns
|
Edit this page
View Source
Delete the oldest session logs so that at most keep remain, never except.
Declaration
public static void Prune(string directory, int keep, string? except = null)
Parameters
|
Edit this page
View Source
Read a log file that may still be written to.
Declaration
public static IReadOnlyList<LogEntry> Read(string path)
Parameters
| Type |
Name |
Description |
| string |
path |
|
Returns