/// <summary> /// Log a message of severity Error /// </summary> /// <param name="c">Category, mapped to categories in EntLib config file</param> /// <param name="m">Message string logged</param> /// <param name="p">Parameters</param> public static void LogError(Constants.Category c, string m, IDictionary <string, object> d = null) { if (Logger.IsLoggingEnabled()) { LogEntry entry = CreateLogEntry(m, c, Constants.Severity.Error); PerformLogging(d, entry); } }
/// <summary> /// Log an object into text file for Audit log /// </summary> /// <param name="m">Message string logged</param> /// <param name="c">Category, mapped to categories in EntLib config file</param> /// <param name="p">Parameters</param> public static void LogObjectInfo(Constants.Category c, object m, Constants.Direction direction) { if (Logger.IsLoggingEnabled()) { // Create a Dictionary of extended properties Dictionary <string, object> exProperties = new Dictionary <string, object>(); exProperties.Add(direction.ToString(), MessageTransform.CreateXML(m)); LogEntry entry = CreateLogEntryWithObject(m.GetType().Name, c, Constants.Severity.Information, exProperties); Logger.Write(entry); } }
/// <summary> /// Log a message of severity Error /// </summary> /// <param name="c">Category, mapped to categories in EntLib config file</param> /// <param name="m">Message string logged</param> /// <param name="p">Parameters</param> public static void LogError(Constants.Category c, Exception ex, LoggingDTO log) { if (Logger.IsLoggingEnabled()) { log.StackTrace = ex.StackTrace; log.ErrorDescription = ex.ToString(); Dictionary <string, object> dic = new Dictionary <string, object>(); dic = log.GetType() .GetProperties(BindingFlags.Instance | BindingFlags.Public) .ToDictionary(prop => prop.Name, prop => prop.GetValue(log, null)); LogEntry entry = CreateLogEntry(ex.Message, c, Constants.Severity.Error); PerformLogging(dic, entry); } }