internal AmbientContext(AmbientContext context) : this() { Id = context.Id; _counterRef = context._counterRef; _originalAmbientContext = GetCurrentContextRaw(); SetCurrentContextRaw(ToObjectArray()); }
private LoggerPhaseScope(CapturedLoggerPhaseScope captured, LogLevel?perfLogLevel) { _originPhaseName = GetPhaseName(); _ac = new AmbientContext(captured.AmbientContext); SetPhaseName(captured.PhaseName); if (perfLogLevel != null) { _performanceScope = new PerformanceScope("Scope:" + captured.PhaseName, perfLogLevel.Value); } }
private LoggerPhaseScope(string phaseName, LogLevel?perfLogLevel, AggregatedPerformanceScope aggregatedPerformanceLogger) { if (string.IsNullOrWhiteSpace(phaseName)) { throw new ArgumentException("Phase name cannot be null or white space.", nameof(phaseName)); } _ac = AmbientContext.GetOrCreateAmbientContext().CreateBranch(); _originPhaseName = GetPhaseName(); phaseName = _originPhaseName == null ? phaseName : _originPhaseName + "." + phaseName; SetPhaseName(phaseName); if (perfLogLevel != null) { _performanceScope = new PerformanceScope("Scope:" + phaseName, perfLogLevel.Value, aggregatedPerformanceLogger); } }
internal AmbientContext(AmbientContext context) : this(context.Id) { _counterRef = context._counterRef; }
private AmbientContext(string id) { Id = id; _originalAmbientContext = GetCurrentContext(); SetAmbientContext(this); }
private static void SetAmbientContext(AmbientContext context) { CallContext.LogicalSetData(AMBCTX_NAME, context); }