public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            var session = ContextRepo.GetSession();

            var log = new LoggedEvent(logLevel, formatter(state, exception), source);

            if (session == null)
            {
                ContextRepo.UnsessionedLogs.Add(log);
            }
            else
            {
                ContextRepo.SessionLogs[session].Add(log);
            }
        }
Exemplo n.º 2
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (IsLogDisabled(logLevel))
            {
                return;                         // for some reasons, some logs are getting here when they shouldn't; so we do one last check here
            }
            var session = Global.TestStubs.GetSession();

            var log = new LoggedEvent(logLevel, formatter(state, exception), source);

            if (session == null)
            {
                UnsessionedData.UnsessionedLogs.Add(log);
            }
            else
            {
                Global.TestStubs.Logs[session].Add(log);
            }
        }