public void Dispose()
 {
     foreach (var log in _streams)
     {
         // provide loggers chance to attach data if needed
         log.OnDetachScopeParameters(_lt, _contextData);
     }
     // clear scope data
     LoggingCallContextStore.Pop(_context);
 }
        public static LoggingCallContextStackFrame Initialize(ILoggingContext context, IEnumerable <KeyValuePair <string, object> > data)
        {
            string FrameID = LoggingCallContextStore.GetFrameID(context);

            var           valueStore = ValueStore(FrameID);
            List <string> keys       = new List <string>();

            foreach (var pair in data)
            {
                keys.Add(pair.Key);
                valueStore.AddOrUpdate(pair.Key, () => pair.Value, (o) => pair.Value);
            }
            ActiveFramesMap().AddOrUpdate(FrameID, () => "active", (o) => "active");
            KeysStore().AddOrUpdate(FrameID, () => keys, (o) => keys);

            return(new LoggingCallContextStackFrame(FrameID));
        }
            public LogScope(
                IEnumerable <ILogStream> streams,
                ILogToken lt,
                List <KeyValuePair <string, object> > contextData)
            {
                foreach (var log in streams)
                {
                    // provide loggers chance to attach data if needed
                    log.OnAttachScopeParameters(lt, contextData);
                }

                // push context data
                _context     = LoggingCallContextStore.Push(contextData);
                _streams     = streams;
                _lt          = lt;
                _contextData = contextData;
            }