コード例 #1
0
ファイル: Log.cs プロジェクト: ArchNet-1/ServiceConsole
 public void SetPriority(eLogPriority pPriority)
 {
     if (pPriority != eLogPriority.NONE)
     {
         _priority = pPriority;
     }
 }
コード例 #2
0
        /// <summary>
        /// Description : Get log from priority
        /// </summary>
        /// <param name="pPriority"></param>
        /// <returns></returns>
        public static List <Log> GetLogFromPriority(eLogPriority pPriority)
        {
            List <Log> lResult = new List <Log>();

            foreach (Log lLog in _allLogs)
            {
                if (lLog.GetLogPriority() == pPriority)
                {
                    lResult.Add(lLog);
                }
            }

            return(lResult);
        }
コード例 #3
0
        /// <summary>
        /// Description : Error Message in Custom Window ( Console Service Window )
        /// </summary>
        public static void Error(string pTitle, eLogPriority pPriority = eLogPriority.NONE, string pMessage = "")
        {
            StackTrace stackTrace = new StackTrace(true);

            // Declare new log
            Log _newLog = new Log();

            _newLog.SetId(_errors.Count + 1);
            _newLog.SetMessage(pMessage);
            _newLog.SetTitle(pTitle);
            _newLog.SetType(eLogType.ERROR);
            _newLog.SetPriority(pPriority);
            _newLog.SetStack(GetStack(stackTrace));

            // Add log in list
            _errors.Add(_newLog);
            _allLogs.Add(_newLog);
        }