This commit is contained in:
“wanyongkang”
2020-12-28 14:55:48 +08:00
parent c2ec7392cb
commit 40a40b6d36
305 changed files with 20629 additions and 20629 deletions

View File

@@ -1,59 +1,59 @@
using System;
using NLog;
namespace Hncore.Infrastructure.Common
{
public class LogHelper
{
private static readonly Logger Log = LogManager.GetLogger("UserLog");
private static string assName = AppDomain.CurrentDomain.FriendlyName;
private static string FormatMsg(string title, object msg)
{
return "Assembly" + assName + "\r\nTitle : " + title + "\r\nMessage : " + msg + "\r\n";
}
public static void Error(string title, object msg = null)
{
Log?.Error(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Debug(string title, object msg = null)
{
Log?.Debug(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Info(string title, object msg = null)
{
Log?.Info(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Warn(string title, object msg = null)
{
Log?.Warn(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Trace(string title, object msg = null)
{
Log?.Trace(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Fatal(string title, object msg = null)
{
Log?.Fatal(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
}
using System;
using NLog;
namespace Hncore.Infrastructure.Common
{
public class LogHelper
{
private static readonly Logger Log = LogManager.GetLogger("UserLog");
private static string assName = AppDomain.CurrentDomain.FriendlyName;
private static string FormatMsg(string title, object msg)
{
return "Assembly" + assName + "\r\nTitle : " + title + "\r\nMessage : " + msg + "\r\n";
}
public static void Error(string title, object msg = null)
{
Log?.Error(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Debug(string title, object msg = null)
{
Log?.Debug(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Info(string title, object msg = null)
{
Log?.Info(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Warn(string title, object msg = null)
{
Log?.Warn(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Trace(string title, object msg = null)
{
Log?.Trace(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
public static void Fatal(string title, object msg = null)
{
Log?.Fatal(FormatMsg(title, msg));
Console.WriteLine(DateTime.Now+"\r\n"+FormatMsg(title, msg));
}
}
}