feat: migracion y ajustes de configuracion, servicios y el sistema de logueo a la nueva app
This commit is contained in:
parent
45f5ec5f84
commit
3348272225
92 changed files with 2676 additions and 19 deletions
29
SHARED/Helper/FileLoggerHelper.cs
Normal file
29
SHARED/Helper/FileLoggerHelper.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
|
||||
namespace Shared.Helper
|
||||
{
|
||||
public class FileLoggerHelper
|
||||
{
|
||||
public static void ConfigureLogger(IConfiguration configuration)
|
||||
{
|
||||
var logFilePath = configuration.GetSection("Logging:LogFile:Path").Value;
|
||||
var logFileFullPath = Path.Combine(Directory.GetCurrentDirectory(), logFilePath);
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.WriteTo.File(logFileFullPath, rollingInterval: RollingInterval.Day)
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
public static void LogInformation(string message)
|
||||
{
|
||||
Log.Information($"{message}");
|
||||
}
|
||||
|
||||
public static void LogError(string message, Exception ex)
|
||||
{
|
||||
Log.Error(ex, message);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue