Exemplo n.º 1
0
        /// <inheritdoc/>
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception?exception, Func <TState, Exception?, string> formatter)
        {
            if (!IsEnabled(logLevel))
            {
                return;
            }

            ICollection <object>?Scopes = null;
            LoggerGroup?         Group  = null;

            ScopeProvider?.ForEachScope(
                (scope, state) =>
            {
                if (Group == null && scope is LoggerGroup LoggerGroup)
                {
                    Group = LoggerGroup;
                    return;
                }
                if (Scopes == null)
                {
                    Scopes = new Collection <object>();
                }
                Scopes.Add(scope);
            },
                state);

            _MessageManager
            .AddMessage(
                LoggerJsonMessage.FromLoggerData(Group?.GroupName, _CategoryName, Scopes, logLevel, eventId, state, exception, formatter));
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception?exception, Func <TState, Exception?, string> formatter)
        {
            if (!IsEnabled(logLevel))
            {
                return;
            }

            _MessageManager.AddMessage(
                LoggerJsonMessage.FromLoggerData(_CategoryName, ScopeProvider, logLevel, eventId, state, exception, formatter));
        }