コード例 #1
0
        private ConsoleTextColor MapLevelToConsoleColor(Domain.LogLevel level)
        {
            if (level == Domain.LogLevel.Error)
            {
                return(ConsoleTextColor.Red);
            }

            return(ConsoleTextColor.White);
        }
コード例 #2
0
        private NLog.LogLevel MapLevel(Domain.LogLevel level)
        {
            switch (level)
            {
            case Domain.LogLevel.Error:
                return(NLog.LogLevel.Error);
            }

            return(NLog.LogLevel.Info);
        }
コード例 #3
0
        public void Log(Domain.LogLevel level, string format, params object[] args)
        {
            // Send to hangfire
            var color = this.MapLevelToConsoleColor(level);

            this.performContext.WriteLine(color, format, args);

            // Persist
            NLog.Fluent.Log.Level(this.MapLevel(level)).Message(format, args).Write();
        }