mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-25 14:41:30 +00:00
Improve file logging
This commit is contained in:
parent
55160ff434
commit
1402bcfd65
1 changed files with 3 additions and 5 deletions
|
@ -12,14 +12,12 @@ public class LighthouseFileLogger : ILogger
|
|||
{
|
||||
FileHelper.EnsureDirectoryCreated(logsDirectory);
|
||||
|
||||
string channel = string.IsNullOrEmpty(line.Area) ? "" : $"[{line.Area}] ";
|
||||
|
||||
string contentFile = $"{channel}{line.Message}\n";
|
||||
string contentAll = $"[{$"{line.Level} {channel}".TrimEnd()}] {line.Message}\n";
|
||||
string contentFile = $"[{line.Level}] <{line.Trace.Name}:{line.Trace.Section}> {line.Message}\n";
|
||||
string contentAll = $"[{line.Area}:{line.Level}] <{line.Trace.Name}:{line.Trace.Section}> {line.Message}\n";
|
||||
|
||||
try
|
||||
{
|
||||
File.AppendAllText(Path.Combine(logsDirectory, line.Level + ".log"), contentFile);
|
||||
File.AppendAllText(Path.Combine(logsDirectory, line.Area + ".log"), contentFile);
|
||||
File.AppendAllText(Path.Combine(logsDirectory, "all.log"), contentAll);
|
||||
}
|
||||
catch(IOException) {} // windows, ya goofed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue