| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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);
- }
- }
|