Exemplo n.º 1
0
        public static void outputLevel(LogLevel setLevel)
        {
            // get current Log file
            uiLog mylog = uiLog.getInstance();

            // set log level
            mylog.outLevel = setLevel;
        }
Exemplo n.º 2
0
 public static uiLog getInstance()
 {
     if (myLogFile == null)
     {
         myLogFile = new uiLog();
     }
     return(myLogFile);
 }
Exemplo n.º 3
0
        public static void LOG(object origin, string FTN, LogLevel logLVL, string msg)
        {
            // get current Log file
            uiLog mylog = uiLog.getInstance();


            string TIME   = mylog.LogTime();
            string LEVEL  = mylog.lvl(logLVL);
            string ORIGIN = mylog.Origin(origin);

            string logLine = TIME + "\tclt\t" + ORIGIN + "." + FTN + "()" + "\t" + LEVEL + "\t" + ORIGIN + "\t" + msg;

            // check if log level is a higher or equal to output level
            if (logLVL == LogLevel.ERROR)
            {
                mylog.logError();
            }
            if ((int)logLVL <= (int)mylog.outLevel)
            {
                try
                {
                    // write log line to current log file
                    using (StreamWriter sw = File.AppendText(mylog.strLogPath))
                    {
                        sw.WriteLine(logLine);
                    }
                }
                catch
                {
                    // do nothing
                }
            }
            // write log line indeterminate of output level
            Debug.WriteLine(logLine);
            // update history
            List <string> tempHistory = new List <string>();

            tempHistory.AddRange(mylog.history);
            mylog.history[0] = logLine;
            for (int i = 1; i < mylog.history.Length; i++)
            {
                mylog.history[i] = tempHistory[i - 1];
            }
        }