Esempio n. 1
0
        private void WriteLog(object obj, ConsoleColor color, LogType type)
        {
            DateTime now = DateTime.Now;

            try
            {
                string info = string.Format("{0}{1} {2} {3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), Logo, type, obj);

                if (doConsolePrint)
                {
                    Console.ForegroundColor = color;
                    Console.WriteLine(info);
                    Console.ResetColor();
                }
                if (doFilePrint)
                {
                    handler.WriteLine(info);
                    handler.CheckFileSize(info.Length, now);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
Esempio n. 2
0
        public override void Write(object obj)
        {
            DateTime now = DateTime.Now;

            try
            {
                string info = string.Format("{0}{1}{2}{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), Logo, "[INFO] ", obj);

                if (doFormPrint)
                {
                    mainFrom.WinFromLog(info, Color.Red);
                }
                if (doFilePrint)
                {
                    handler.WriteLine(info);
                    handler.CheckFileSize(info.Length, now);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }