diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-06 02:10:44 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-06 02:10:44 -0600 |
commit | 08819c6738a4f82ccf07ae5ed60835b087f7bb34 (patch) | |
tree | 9c0c77626587136d41002769fb5a030e1be2f5b8 /Services | |
parent | f060c4f88f635af3295ea7652cbbbd08dbf1c6cf (diff) |
Añadidos grupos y usuarios
Diffstat (limited to 'Services')
-rw-r--r-- | Services/LoggerService.cs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/Services/LoggerService.cs b/Services/LoggerService.cs index dd78e23..64eecb1 100644 --- a/Services/LoggerService.cs +++ b/Services/LoggerService.cs @@ -1,15 +1,11 @@ -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Hosting; +// Singleton service. namespace LibraryAPI.Services { - public class LoggerService : IHostedService { - private readonly IWebHostEnvironment env; - private readonly string log_file = "Log.txt"; + public class LoggerService : BaseService, IHostedService { private Timer timer; - public LoggerService(IWebHostEnvironment env) { - this.env = env; - } + public LoggerService(IWebHostEnvironment env) : base(env) { } public Task StartAsync(CancellationToken cancel_token) { timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromMinutes(5)); @@ -25,13 +21,5 @@ namespace LibraryAPI.Services { timer.Dispose(); return Task.CompletedTask; } - - private void LogToFile(string message) { - var path = $@"{env.ContentRootPath}/wwwroot/{log_file}"; - - using (StreamWriter w = new StreamWriter(path, append: true)) { - w.WriteLine(message); - } - } } } |