Taylohtio/CustomNavigationProvider/CustomNavigationCommon/LogUtils.cs

105 lines
2.4 KiB
C#

using System;
using System.IO;
using System.Web;
using System.Text;
using System.ComponentModel;
using System.Diagnostics;
using Microsoft.Practices.EnterpriseLibrary.Logging;
namespace Taloyhtio.CustomNavigationCommon
{
public class LogUtils
{
public static void LogDebug(String msg)
{
try
{
LogEntry entry = new LogEntry();
entry.Severity = TraceEventType.Information;
entry.Message = msg;
Logger.Write(entry);
}
catch
{
}
}
public static void LogDebug(string msg, params object[] param)
{
try
{
LogDebug(String.Format(msg, param));
}
catch
{
}
}
public static void LogWarning(String msg, Exception ex)
{
try
{
LogEntry entry = new LogEntry();
entry.Severity = TraceEventType.Warning;
entry.Message = msg + Environment.NewLine + ex.Message;
Logger.Write(entry);
}
catch (Exception)
{
}
}
public static void LogWarning(String msg)
{
try
{
LogEntry entry = new LogEntry();
entry.Severity = TraceEventType.Warning;
entry.Message = msg;
Logger.Write(entry);
}
catch
{
}
}
public static void LogError(Exception ex)
{
try
{
LogEntry entry = new LogEntry();
entry.Severity = TraceEventType.Error;
entry.Message = ex.Message;
Logger.Write(entry);
}
catch
{
}
}
public static void LogError(string msg)
{
try
{
LogEntry entry = new LogEntry();
entry.Severity = TraceEventType.Error;
entry.Message = msg;
Logger.Write(entry);
}
catch
{
}
}
public static void LogError(string msg, params object[] param)
{
try
{
LogError(String.Format(msg, param));
}
catch
{
}
}
}
}