コード例 #1
0
        public static void Log(ActionMessage msg)
        {
            new Thread(() =>
            {
                lock (syncLock)
                {
                    printLevel(msg.Level);
                    PrintCurrentTime();
                    PrintCaller(msg);
                    PrintMessage(msg.Message, msg.Level);
                    if (LogToFile)
                    {
                        if (currentFileName.Equals(string.Empty))
                        {
                            currentFileName = RELATIVE_LOG_PATH + GetCurrentDateTimeFormated() + ".log";
                        }

                        WriteFile(currentFileName, true, GetLogString(msg) + Environment.NewLine);
                    }
                }
            }).Start();
        }
コード例 #2
0
 private static string GetSourceString(ActionMessage msg)
 {
     return(msg.Source + " => ");
 }
コード例 #3
0
 private static void PrintCaller(ActionMessage msg)
 {
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.Write(GetSourceString(msg));
 }