39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
|
|
namespace Shared.Helper
|
|
{
|
|
public static class ConsoleLoggerHelper
|
|
{
|
|
public static void WriteLineAndLogInfo(string msj, ConsoleColor? color = null)
|
|
{
|
|
if (color.HasValue && Enum.IsDefined(typeof(ConsoleColor), color.Value))
|
|
{
|
|
Console.ForegroundColor = color.Value;
|
|
Console.WriteLine(msj);
|
|
Console.ResetColor();
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine(msj);
|
|
}
|
|
|
|
FileLoggerHelper.LogInformation(msj);
|
|
}
|
|
|
|
public static void WriteLineAndLogEventoAsync(string evento, string proceso, string operacion = "", ConsoleColor? color = null)
|
|
{
|
|
if (color.HasValue && Enum.IsDefined(typeof(ConsoleColor), color.Value))
|
|
{
|
|
Console.ForegroundColor = color.Value;
|
|
Console.WriteLine(proceso);
|
|
Console.ResetColor();
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine(proceso);
|
|
}
|
|
|
|
FileLoggerHelper.LogInformation(proceso);
|
|
}
|
|
}
|
|
}
|