Esempio n. 1
0
 static LogRead()
 {
     if (Log == null)
     {
         Log = new LogRead();
     }
 }
Esempio n. 2
0
 static LogData()
 {
     if (Log == null)
     {
         Log = new LogData();
     }
 }
Esempio n. 3
0
 static LogPOSTIFactory()
 {
     if (Log == null)
     {
         Log = new LogPOSTIFactory();
     }
 }
Esempio n. 4
0
 static LogPOSTOktoStart()
 {
     if (Log == null)
     {
         Log = new LogPOSTOktoStart();
     }
 }
Esempio n. 5
0
 static LogPOSTJGP()
 {
     if (Log == null)
     {
         Log = new LogPOSTJGP();
     }
 }
Esempio n. 6
0
        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();
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
 public Logger(ILogType logType)
 {
     this.LogType = logType;
 }
Esempio n. 11
0
 public void Log(string logMessage, ILogType logType)
 {
     this.LogType = logType;
     this.Log(logMessage);
 }
Esempio n. 12
0
 public Logger(ILogType iLogType)
 {
     logType = iLogType;
 }
Esempio n. 13
0
 public LogShould()
 {
     LogType = new Mock <ConsoleLogType>();
     logger  = new Logger(LogType);
 }
Esempio n. 14
0
 public void Send(Email email, ILogType logType)
 {
     // ... sending...
     logType.Log(email);
 }