Ejemplo n.º 1
0
        private static void WriteLogToRam(LogsBuffer log)
        {
            Console.ForegroundColor = log.Type == TypeOfLog.Error ? ConsoleColor.Red
                : log.Type == TypeOfLog.OK ? ConsoleColor.Green
                : log.Type == TypeOfLog.Start || log.Type == TypeOfLog.End ? ConsoleColor.Magenta
                : log.Type == TypeOfLog.Warning ? ConsoleColor.Yellow : ConsoleColor.White;

            Console.WriteLine(log.Type.ToString() + ":" + log.Code + ":" + log.Value);

            buffers.Add(log);
            if (buffers.Count > MaxBufferSize)
            {
                StackOverFlow = true;
                buffers.Clear();
            }
        }
Ejemplo n.º 2
0
        public static void WriteLog(string value)
        {
            LogsBuffer log = new LogsBuffer();

            log.Value        = value;
            log.CreationDate = DateTime.Now;
            if (value.StartsWith("OK"))
            {
                log.Type = TypeOfLog.OK;
            }
            else if (value.StartsWith("INFO"))
            {
                log.Type = TypeOfLog.Info;
            }
            else if (value.StartsWith("Error"))
            {
                log.Type = TypeOfLog.Error;
            }

            WriteLogToRam(log);
        }