- shit: Cleanup this mess
This commit is contained in:
@@ -5,20 +5,19 @@ namespace Nebula.Shared.Services;
|
||||
[ServiceRegister]
|
||||
public class DebugService : IDisposable
|
||||
{
|
||||
public ILogger Logger;
|
||||
|
||||
private static string LogPath = Path.Combine(FileService.RootPath, "log");
|
||||
public DateTime LogDate = DateTime.Now;
|
||||
public ILogger Logger;
|
||||
private FileStream LogStream;
|
||||
private StreamWriter LogWriter;
|
||||
|
||||
public DebugService(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
|
||||
|
||||
//if (!Directory.Exists(LogPath))
|
||||
// Directory.CreateDirectory(LogPath);
|
||||
|
||||
// Directory.CreateDirectory(LogPath);
|
||||
|
||||
//var filename = String.Format("{0:yyyy-MM-dd}.txt", DateTime.Now);
|
||||
|
||||
//LogStream = File.Open(Path.Combine(LogPath, filename),
|
||||
@@ -26,6 +25,12 @@ public class DebugService : IDisposable
|
||||
//LogWriter = new StreamWriter(LogStream);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
LogWriter.Dispose();
|
||||
LogStream.Dispose();
|
||||
}
|
||||
|
||||
public void Debug(string message)
|
||||
{
|
||||
Log(LoggerCategory.Debug, message);
|
||||
@@ -44,16 +49,10 @@ public class DebugService : IDisposable
|
||||
public void Error(Exception e)
|
||||
{
|
||||
Error(e.Message + "\r\n" + e.StackTrace);
|
||||
if(e.InnerException != null)
|
||||
if (e.InnerException != null)
|
||||
Error(e.InnerException);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
LogWriter.Dispose();
|
||||
LogStream.Dispose();
|
||||
}
|
||||
|
||||
private void Log(LoggerCategory category, string message)
|
||||
{
|
||||
Logger.Log(category, message);
|
||||
|
||||
Reference in New Issue
Block a user