using Log; namespace PLCIOPointTool.Services; public class LogService : ILog { private readonly IOutputService _outputService; private bool disposedValue; public LogService(IOutputService outputService) { _outputService= outputService; } public string? Directory => null; public string? FilePath => null; public bool Initialize(string fileName) { throw new NotImplementedException(); } public bool Info(string message, DateTime? dateTime = null) { _outputService.Output($"[{DateTime.Now.ToString()}] Log->Info:{message}"); return true; } public bool Debug(string message, DateTime? dateTime = null) { _outputService.Output($"[{DateTime.Now.ToString()}] Log->Debug:{message}"); return true; } public bool Warning(string message, DateTime? dateTime = null) { _outputService.Output($"[{DateTime.Now.ToString()}] Log->Warning:{message}"); return true; } public bool Error(string message, DateTime? dateTime = null) { _outputService.Output($"[{DateTime.Now.ToString()}] Log->Error:{message}"); return true; } public bool Fatal(string message, DateTime? dateTime = null) { _outputService.Output($"[{DateTime.Now.ToString()}] Log->Fatal:{message}"); return true; } protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects) } // TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: set large fields to null disposedValue = true; } } // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources // ~LogService() // { // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method // Dispose(disposing: false); // } public void Dispose() { // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method Dispose(disposing: true); GC.SuppressFinalize(this); } }