static LogRead() { if (Log == null) { Log = new LogRead(); } }
static LogData() { if (Log == null) { Log = new LogData(); } }
static LogPOSTIFactory() { if (Log == null) { Log = new LogPOSTIFactory(); } }
static LogPOSTOktoStart() { if (Log == null) { Log = new LogPOSTOktoStart(); } }
static LogPOSTJGP() { if (Log == null) { Log = new LogPOSTJGP(); } }
public void Log(ILogType LogType, Exception Ex = null) { Doc.LoadXml(CacheProxy.Instance().GetValue("Log").ToString()); string Message = LogType.GetMessage(); XmlElement X_ChildElement = CreateXMLNode(LogType, Message, Ex); Doc.LastChild.PrependChild(X_ChildElement); SaveXML(); }
public bool MonitorAndStartLog(IMonitor monitor, ILogType logtype) { bool running = false; Int64 logstartTickCount = 0; Int32 monitorInterval = monitor.getMonitorInterval() * 1000;//In Ms try { while (true) { Int64 threshold = monitor.monitor(_cmdline.PID); if (running) { Int64 currentTickcount = System.Environment.TickCount; if (currentTickcount >= logstartTickCount + (Int64)_cmdline.RunDurationInSecs * 1000) { logtype.stop(); running = false; break; } } else { if (threshold >= _cmdline.Threshold) { if (logtype.start()) { Logger.Log("Running log collection for " + _cmdline.RunDurationInSecs + "Secs!!!"); logstartTickCount = System.Environment.TickCount; running = true; } else { Logger.Log("Failed to run log collection. Exit"); break; } } } Thread.Sleep(monitorInterval); } } catch (Exception e) { Logger.Log("Exception in MonitorAndStartLog: " + e.Message); } finally { logtype.stop(); running = false; } return(true); }
private XmlElement CreateXMLNode(ILogType LogType, string Message, Exception ex) { StackTrace StackTraceObj = new StackTrace(ex, true); XmlElement X_Log = Doc.CreateElement("log"); XmlElement X_ChildElement = Doc.CreateElement("level"); XmlText X_Text = Doc.CreateTextNode(Message); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("date"); X_Text = Doc.CreateTextNode(DateTime.Now.ToString()); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("exceptionType"); X_Text = Doc.CreateTextNode(ex.GetType().Name); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("functionName"); X_Text = Doc.CreateTextNode(StackTraceObj.GetFrame(0) != null ? StackTraceObj.GetFrame(0).GetMethod().Name : ""); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("fileLocation"); X_Text = Doc.CreateTextNode(StackTraceObj.GetFrame(0) != null ? StackTraceObj.GetFrame(0).GetFileName() : ""); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("lineNumber"); X_Text = Doc.CreateTextNode(StackTraceObj.GetFrame(0) != null ? StackTraceObj.GetFrame(0).GetFileLineNumber().ToString() : ""); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("message"); X_Text = Doc.CreateTextNode(ex.Message); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("stackTrace"); X_Text = Doc.CreateTextNode(ex.ToString()); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); X_ChildElement = Doc.CreateElement("BackgroundColor"); X_Text = Doc.CreateTextNode(LogType.HTMLCSS); X_ChildElement.AppendChild(X_Text); X_Log.AppendChild(X_ChildElement); return(X_Log); }
public void Log(string txt, ILogType typ, bool c = false) { AwesomePixel.LogType lt; bool a = Enum.TryParse <LogType>(Enum.GetName(typeof(ILogType), typ), out lt); if (a == false) { Utils.Log("Plugin API failed to log, enum conversion failed", LogType.FAIL); return; } Utils.Log(txt, lt, c); }
public Logger(ILogType logType) { this.LogType = logType; }
public void Log(string logMessage, ILogType logType) { this.LogType = logType; this.Log(logMessage); }
public Logger(ILogType iLogType) { logType = iLogType; }
public LogShould() { LogType = new Mock <ConsoleLogType>(); logger = new Logger(LogType); }
public void Send(Email email, ILogType logType) { // ... sending... logType.Log(email); }