< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.Framing.ConnectionIdWrappingLogger
Assembly: CoreWCF.NetNamedPipe
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetNamedPipe/src/CoreWCF/Channels/Framing/ConnectionIdWrappingLogger.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 39
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
BeginScope(...)100%110%
IsEnabled(...)100%110%
Log(...)0%220%
ConnectionIdFormatter(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetNamedPipe/src/CoreWCF/Channels/Framing/ConnectionIdWrappingLogger.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System;
 5using Microsoft.Extensions.Logging;
 6
 7namespace CoreWCF.Channels.Framing
 8{
 9    internal class ConnectionIdWrappingLogger : ILogger
 10    {
 11        private ILogger _innerLogger;
 12        private string _connectionId;
 13
 014        public ConnectionIdWrappingLogger(ILogger innerLogger, string connectionId)
 15        {
 016            _innerLogger = innerLogger;
 017            _connectionId = connectionId;
 018        }
 019        public IDisposable BeginScope<TState>(TState state) => _innerLogger.BeginScope(state);
 20
 021        public bool IsEnabled(LogLevel logLevel) => _innerLogger.IsEnabled(logLevel);
 22
 23        public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exce
 24        {
 025            (TState state, string connectionId, Func<TState, Exception, string> origFormatter) newState = (state, _conne
 026            _innerLogger.Log(logLevel, eventId, newState, exception, ConnectionIdFormatter<TState>);
 027        }
 28
 29        private static string ConnectionIdFormatter<TState>((TState state, string connectionId, Func<TState, Exception, 
 30        {
 031            var state = modifiedState.state;
 032            var connectionId = modifiedState.connectionId;
 033            var formatter = modifiedState.formatter;
 034            var formattedString = formatter(state, exception);
 035            return $"[{connectionId}] {formattedString}";
 36        }
 37    }
 38
 39}