From 08819c6738a4f82ccf07ae5ed60835b087f7bb34 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sun, 6 Nov 2022 02:10:44 -0600 Subject: AƱadidos grupos y usuarios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Services/LoggerService.cs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'Services') 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); - } - } } } -- cgit v1.2.3