LogService.cs 517 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace AlarmInfoServerSim.Services
  7. {
  8. public class LogService : ILogService
  9. {
  10. public LogService()
  11. {
  12. }
  13. public void Log(string message)
  14. {
  15. string logFormat = $"[{DateTime.Now.ToString()}] Content: {message} ";
  16. LogReceived?.Invoke(null, logFormat);
  17. }
  18. public event EventHandler<string>? LogReceived;
  19. }
  20. }