static Log() { try { LoggingService = new LoggingService(); } catch (Exception e) { Ultities.EventLogException("Tracer constructor", e); } }
public static void LogDebug(string message, params object[] parameters) { try { string fullName = Assembly.GetCallingAssembly().FullName; LogMessage(LogLevel.Debug, message + FormatParams(parameters), null, fullName, null, 0, false); } catch (Exception e) { Ultities.EventLogException("Tracer.TraceDebug", e); } }
public static void LogTrace(LogLevel severity, string message) { try { string fullName = Assembly.GetCallingAssembly().FullName; LogMessage(severity, message, null, fullName, null, 0, false); } catch (Exception e) { Ultities.EventLogException("Tracer.Trace", e); } }
public static void LogInfo(string message, params object[] parameters) { try { LogMessage(LogLevel.Info, message + FormatParams(parameters), null, Assembly.GetCallingAssembly().FullName, null, 0, false); } catch (Exception e) { Ultities.EventLogException("Tracer.TraceInfo", e); } }
public static void LogError(string errorMessage, int errorNumber = 0) { try { string fullName = Assembly.GetCallingAssembly().FullName; LogMessage(LogLevel.Error, errorMessage, null, fullName, null, errorNumber, false); } catch (Exception e) { Ultities.EventLogException("Tracer.TraceError", e); } }
private LogLevel GetNLogLevelFromSeverity(int severity) { LogLevel info = LogLevel.Info; try { info = LogLevel.FromOrdinal(severity); } catch (Exception e) { Ultities.EventLogException("LoggingService.GetNLogLevelFromSeverity", e); } return(info); }
private static void LogException(LogLevel severity, Exception exception, string message = null) { try { string fullName = Assembly.GetCallingAssembly().FullName; if (!string.IsNullOrEmpty(message)) { LogMessage(severity, message, null, fullName, null, 0, false); } LogMessage(severity, null, null, fullName, exception, 0, false); } catch (Exception e) { Ultities.EventLogException("Tracer.TraceException", e); } }
public static void LogDataSet(LogLevel severity, DataSet dataset) { string fullName = Assembly.GetCallingAssembly().FullName; try { if (dataset == null) { LogMessage(LogLevel.Error, "TraceDataSet called with a null dataset", null, fullName, null, 0, false); } else { string tempFileName = Path.GetTempFileName(); dataset.WriteXml(tempFileName); LogMessage(severity, "The DataSet file was written to:" + tempFileName, null, fullName, null, 0, false); } } catch (Exception e) { Ultities.EventLogException("Logger.LogDataSet", e); } }
private static void LogFunc(string functionName, bool enterFunc = false, params object[] parameters) { string fullName = Assembly.GetCallingAssembly().FullName; string isEnterStr = enterFunc ? "LogEnterFunc" : "LogExitFunc"; try { if (string.IsNullOrEmpty(functionName)) { LogMessage(LogLevel.Error, isEnterStr + " called with a null function name.", null, fullName, null, 0, false); } else { LogMessage(LogLevel.Trace, isEnterStr + functionName + FormatParams(parameters), null, fullName, null, 0, false); } } catch (Exception e) { Ultities.EventLogException("Logger.Logger." + isEnterStr, e); } }