public static void LogDebug(string method, string source, string message) { DebugMessageAgent agent = null; if (!string.IsNullOrEmpty(message)) Console.WriteLine(message); try { agent = new DebugMessageAgent(); var msg = new DebugLogMessage { Username = Constants.SYSTEM_USER_NAME, LoggingLevel = LoggingLevels.DebugInfo, MethodName = method, Source = source, Message = message }; agent.DispatchDebugMessage(msg); } catch (Exception ex) { LogException(Constants.SYSTEM_USER_NAME, ex); } finally { if (agent != null) agent.Close(); } }
public static void LogDebug(string user, string method, string source, string message) { DebugMessageAgent agent = null; try { agent = new DebugMessageAgent(); var msg = new DebugLogMessage { Username = user, LoggingLevel = LoggingLevels.DebugInfo, MethodName = method, Source = source, Message = message }; agent.DispatchDebugMessage(msg); } catch (Exception ex) { LogException(user, ex); } finally { if (agent != null) agent.Close(); } }
public void DispatchDebugMessage(DebugLogMessage msg) { try { var info = new Log { Username = msg.Username, Timestamp = msg.Timestamp, LoggingLevel = (int) msg.LoggingLevel, Message = msg.Message, MethodName = msg.MethodName, Source = msg.Source }; db.Logs.InsertOnSubmit(info); db.SubmitChanges(); } catch (Exception ex) { LoggingUtility.LogException(Constants.SYSTEM_USER_NAME, ex); } }
public static void LogWarning(string method, string source, string message) { DebugMessageAgent agent = null; try { agent = new DebugMessageAgent(); var msg = new DebugLogMessage { Username = Constants.SYSTEM_USER_NAME, LoggingLevel = LoggingLevels.Warning, MethodName = method, Source = source, Message = message }; agent.DispatchDebugMessage(msg); } catch (Exception ex) { LogException(Constants.SYSTEM_USER_NAME, ex); } finally { if (agent != null) agent.Close(); } }