Beispiel #1
0
        public void Write(QubeLogLevel lvl, ConsoleColor? col, Object s)
        {
            lock (QubeLogShared.ObjMutex)
            {
                if(!HasCustomFilename)
                    Refresh();

                QubeLogShared.Buf = String.Format("{0} [{1}] [{2}] > {3}",
                                                DateTime.Now.ToString("MM-dd HH:mm:ss"),
                                                lvl.ToString(),
                                                Tag,
                                                s
                                            );

                if (Parent.EnableConsole)
                {
                    if (col == null)
                    {
                        Console.ResetColor();
                        switch (lvl)
                        {
                            default:
                                break;
                            case QubeLogLevel.Error:
                                Console.ForegroundColor = ConsoleColor.Red;
                                break;
                            case QubeLogLevel.Information:
                                Console.ForegroundColor = ConsoleColor.Magenta;
                                break;
                            case QubeLogLevel.Verbose:
                                Console.ForegroundColor = ConsoleColor.Green;
                                break;
                            case QubeLogLevel.Warning:
                                Console.ForegroundColor = ConsoleColor.Yellow;
                                break;
                        }
                    }
                    else
                        Console.ForegroundColor = col.Value;

                    Console.WriteLine(QubeLogShared.Buf);
                }

                if (sw != null)
                    sw.WriteLine(QubeLogShared.Buf);
            }
        }
Beispiel #2
0
 public void Write(QubeLogLevel lvl, Object s)
 {
     Write(lvl, null, s);
 }