Exemple #1
0
        public override void Log <TState>(DateTimeOffset timestamp, LogLevel logLevel, EventId _, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (!IsEnabled(logLevel))
            {
                return;
            }

            var r = new StringBuilder();

            r.AppendLine(formatter(state, exception));

            if (exception != null)
            {
                r.AppendLine(exception.ToLogString());
            }

            Provider.AddMessage(timestamp, r.ToString(), exception?.GetUsefulStack(), (int)logLevel);
        }
Exemple #2
0
        public override void Log <TState>(DateTimeOffset timestamp, LogLevel logLevel, EventId _, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (!IsEnabled(logLevel))
            {
                return;
            }

            Console.WriteLine("EventBusLogger: Log");

            var r = new StringBuilder();

            r.AppendLine(formatter(state, exception));

            if (exception != null)
            {
                r.AppendLine(exception.ToFullMessage());
            }

            Console.WriteLine("EventBusLogger: sending log to provider");
            Provider.AddMessage(timestamp, r.ToString(), (int)logLevel);
        }