Exemplo n.º 1
0
        public void Log(string message, LoggerSeverity severity, object reference = null)
        {
            LoggerSeverity getMostSevere(int s)
            {
                int i = 0;

                while (s != 0)
                {
                    s /= 2;
                    i++;
                }

                return((LoggerSeverity)(1 << (i - 1)));
            }

            int sev = ((int)severity & (int)Take);

            if (sev == 0)
            {
                return;
            }

            Console.ForegroundColor = _colorTable[getMostSevere(sev)];
            Console.WriteLine($"[{severity.ToString()}][{message}]");
            Console.ResetColor();

            OnLog?.Invoke(message, severity, reference);
        }
Exemplo n.º 2
0
        private void Log(LoggerSeverity severity, string message, params object[] args)
        {
            string severityStr = severity.ToString().ToUpper();

            message = string.Format("[{0}][{1}]: {2}", Name, severityStr, message);
            Logger.Log(message, args);
        }