Add fields to get filepaths
This commit is contained in:
parent
0dac5e72be
commit
9d55601a27
@ -7,7 +7,7 @@
|
|||||||
<Authors>Glax</Authors>
|
<Authors>Glax</Authors>
|
||||||
<RepositoryUrl>https://git.bernloehr.eu/glax/GlaxLogger</RepositoryUrl>
|
<RepositoryUrl>https://git.bernloehr.eu/glax/GlaxLogger</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Version>1.0.6</Version>
|
<Version>1.0.7</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,6 +6,7 @@ namespace GlaxLogger;
|
|||||||
public class Logger : ILogger, IDisposable, IAsyncDisposable
|
public class Logger : ILogger, IDisposable, IAsyncDisposable
|
||||||
{
|
{
|
||||||
private LogLevel _filterLevel;
|
private LogLevel _filterLevel;
|
||||||
|
public readonly string LogFilePath, FilteredLogFilePath;
|
||||||
private readonly FileStream _allMessageLogfile, _filteredLogfile;
|
private readonly FileStream _allMessageLogfile, _filteredLogfile;
|
||||||
private readonly ConsoleColor _defaultForegroundColor = Console.ForegroundColor;
|
private readonly ConsoleColor _defaultForegroundColor = Console.ForegroundColor;
|
||||||
private readonly ConsoleColor _defaultBackgroundColor = Console.BackgroundColor;
|
private readonly ConsoleColor _defaultBackgroundColor = Console.BackgroundColor;
|
||||||
@ -16,8 +17,10 @@ public class Logger : ILogger, IDisposable, IAsyncDisposable
|
|||||||
this._filterLevel = filteredLevel;
|
this._filterLevel = filteredLevel;
|
||||||
string logFolderPath = outputFolderPath ?? Path.Join(Environment.CurrentDirectory, "logs");
|
string logFolderPath = outputFolderPath ?? Path.Join(Environment.CurrentDirectory, "logs");
|
||||||
Directory.CreateDirectory(logFolderPath);
|
Directory.CreateDirectory(logFolderPath);
|
||||||
this._filteredLogfile = new FileStream(Path.Join(logFolderPath, $"{DateTime.Now:yyyy-MM-dd HH.mm.ss}-filtered.log"), FileMode.Create);
|
this.LogFilePath = Path.Join(logFolderPath, $"{DateTime.Now:yyyy-MM-dd HH.mm.ss}.log");
|
||||||
this._allMessageLogfile = new FileStream(Path.Join(logFolderPath, $"{DateTime.Now:yyyy-MM-dd HH.mm.ss}.log"), FileMode.Create);
|
this.FilteredLogFilePath = Path.Join(logFolderPath, $"{DateTime.Now:yyyy-MM-dd HH.mm.ss}-filtered.log");
|
||||||
|
this._allMessageLogfile = new FileStream(this.LogFilePath, FileMode.Create);
|
||||||
|
this._filteredLogfile = new FileStream(this.FilteredLogFilePath, FileMode.Create);
|
||||||
this._consoleOut = consoleOut ?? Console.Out;
|
this._consoleOut = consoleOut ?? Console.Out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user