Exemple #1
0
        /// <summary>
        /// Write a Exception and raise a handle when handler is aviliable.
        /// </summary>
        /// <param name="notice">Exception content</param>
        public static void WriteException(NoticeResult notice)
        {
            string content = string.Format("{0}  {1,-4}:  ", DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss:fffffff"), notice.Index == -1 ? _index++ : notice.Index);

            if (notice.Exception != null)
            {
                content += notice.Exception.ToString() + "\t";
            }
            if (ExceptionHandler != null)
            {
                ExceptionHandler(notice.Exception);
            }
            Console.WriteLine($"{content}");
        }
Exemple #2
0
        public static event Action <Exception> ExceptionHandler;     // Handle data when exception is record.
        #endregion

        #region Public Functions
        /// <summary>
        /// Write a Log and raise a handle when handler is aviliable.
        /// </summary>
        /// <param name="notice">Log content</param>
        public static void WriteLog(NoticeResult notice)
        {
            string content = string.Format("{0}  {1,-4}:  ", DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss:fffffff"), notice.Index == -1 ? _index++ : notice.Index);

            if (notice.Message != null)
            {
                content += notice.Message + "\t";
            }
            if (LogHandler != null)
            {
                LogHandler(content);
            }
            Console.WriteLine($"{content}");
        }
Exemple #3
0
        /// <summary>
        /// Write a Message.
        /// </summary>
        /// <param name="notice">Message</param>
        public static void WriteMessage(NoticeResult notice)
        {
            string content = string.Format("{0}  {1,-4}:  ", DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss:fffffff"), notice.Index == -1 ? _index++ : notice.Index);

            Console.WriteLine($"{content}");
        }