first commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]
|
||||
public class Logger
|
||||
{
|
||||
private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
|
||||
private static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
|
||||
private static readonly log4net.ILog logmqtt = log4net.LogManager.GetLogger("logmqtt");
|
||||
private static readonly log4net.ILog logWHX = log4net.LogManager.GetLogger("logWHX");
|
||||
|
||||
public static void WriteInfo(string info)
|
||||
{
|
||||
Console.WriteLine(info);
|
||||
if (loginfo.IsInfoEnabled)
|
||||
{
|
||||
loginfo.Info(info);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteMqtt(string info)
|
||||
{
|
||||
Console.WriteLine(info);
|
||||
if (logmqtt.IsInfoEnabled)
|
||||
{
|
||||
logmqtt.Info(info);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteError(string error)
|
||||
{
|
||||
Console.WriteLine(error);
|
||||
if (logerror.IsErrorEnabled)
|
||||
{
|
||||
logerror.Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteError(string info, Exception ex)
|
||||
{
|
||||
Console.WriteLine(info);
|
||||
if (logerror.IsErrorEnabled)
|
||||
{
|
||||
logerror.Error(info, ex);
|
||||
}
|
||||
}
|
||||
public static void WriteWHX(string info)
|
||||
{
|
||||
Console.WriteLine(info);
|
||||
if (logWHX.IsErrorEnabled)
|
||||
{
|
||||
logWHX.Error(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user