예제 #1
0
 internal AmbientContext(AmbientContext context) : this()
 {
     Id                      = context.Id;
     _counterRef             = context._counterRef;
     _originalAmbientContext = GetCurrentContextRaw();
     SetCurrentContextRaw(ToObjectArray());
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
파일: AmbientContext.cs 프로젝트: ili/docfx
 internal AmbientContext(AmbientContext context) : this(context.Id)
 {
     _counterRef = context._counterRef;
 }
예제 #5
0
파일: AmbientContext.cs 프로젝트: ili/docfx
 private AmbientContext(string id)
 {
     Id = id;
     _originalAmbientContext = GetCurrentContext();
     SetAmbientContext(this);
 }
예제 #6
0
파일: AmbientContext.cs 프로젝트: ili/docfx
 private static void SetAmbientContext(AmbientContext context)
 {
     CallContext.LogicalSetData(AMBCTX_NAME, context);
 }