Data required by IActivityMonitor.UnfilteredOpenGroup.
Inheritance: ActivityMonitorLogData
Esempio n. 1
0
        IDisposableGroup DoOpenGroup(ActivityMonitorGroupData data)
        {
            Debug.Assert(_enteredThreadId == Thread.CurrentThread.ManagedThreadId);

            int idxNext = _current != null ? _current.Index + 1 : 0;

            if (idxNext == _groups.Length)
            {
                Array.Resize(ref _groups, _groups.Length * 2);
                for (int i = idxNext; i < _groups.Length; ++i)
                {
                    _groups[i] = new Group(this, i);
                }
            }
            _current = _groups[idxNext];
            if (!data.IsFilteredLog)
            {
                if (_actualFilterIsDirty)
                {
                    DoResyncActualFilter();
                }
                if (_actualFilter.Group == LogLevelFilter.Off || data.Level == LogLevel.None)
                {
                    _current.InitializeRejectedGroup(data);
                    return(_current);
                }
            }
            _lastLogTime = data.CombineTagsAndAdjustLogTime(_currentTag, _lastLogTime);
            _current.Initialize(data);
            _currentUnfiltered = _current;
            MonoParameterSafeCall((client, group) => client.OnOpenGroup(group), _current);
            return(_current);
        }
 /// <summary>
 /// Initializes or reinitializes this group (if it has been disposed) as a filtered group.
 /// </summary>
 internal void InitializeRejectedGroup(ActivityMonitorGroupData data)
 {
     SavedMonitorFilter = Monitor._configuredFilter;
     SavedMonitorTags   = Monitor._currentTag;
     _unfilteredParent  = Monitor._currentUnfiltered;
     _depth             = 0;
     _data = data;
 }
 /// <summary>
 /// Initializes or reinitializes this group (if it has been disposed). 
 /// </summary>
 internal void Initialize( ActivityMonitorGroupData data )
 {
     SavedMonitorFilter = Monitor._configuredFilter;
     SavedMonitorTags = Monitor._currentTag;
     if( (_unfilteredParent = Monitor._currentUnfiltered) != null ) _depth = _unfilteredParent._depth + 1;
     else _depth = 1;
     // Logs everything when a Group is an error: we then have full details available without
     // logging all with Error or Fatal.
     if( data.MaskedLevel >= LogLevel.Error && Monitor._configuredFilter != LogFilter.Debug ) Monitor.DoSetConfiguredFilter( LogFilter.Debug );
     _closeLogTime = DateTimeStamp.MinValue;
     _data = data;
 }
Esempio n. 4
0
 /// <summary>
 /// Opens a group regardless of <see cref="ActualFilter"/> level (except for <see cref="LogLevelFilter.Off"/>).
 /// <see cref="CloseGroup"/> must be called in order to close the group, and/or the returned object must be disposed (both safely can be called:
 /// the group is closed on the first action, the second one is ignored).
 /// </summary>
 /// <param name="data">Data that describes the log. Can not be null.</param>
 /// <returns>A disposable object that can be used to set a function that provides a conclusion text and/or close the group.</returns>
 /// <remarks>
 /// <para>
 /// Opening a group does not change the current <see cref="MinimalFilter"/>, except when opening a <see cref="LogLevel.Fatal"/> or <see cref="LogLevel.Error"/> group:
 /// in such case, the MinimalFilter is automatically sets to <see cref="LogFilter.Debug"/> to capture all potential information inside the error group.
 /// </para>
 /// <para>
 /// Changes to the monitor's current Filter or AutoTags that occur inside a group are automatically restored to their original values when the group is closed.
 /// This behavior guaranties that a local modification (deep inside unknown called code) does not impact caller code: groups are a way to easily isolate such
 /// configuration changes.
 /// </para>
 /// <para>
 /// Note that this automatic configuration restoration works even if the group has been filtered.
 /// </para>
 /// </remarks>
 public virtual IDisposableGroup UnfilteredOpenGroup(ActivityMonitorGroupData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     ReentrantAndConcurrentCheck();
     try
     {
         return(DoOpenGroup(data));
     }
     finally
     {
         ReentrantAndConcurrentRelease();
     }
 }
 /// <summary>
 /// Initializes or reinitializes this group (if it has been disposed).
 /// </summary>
 internal void Initialize(ActivityMonitorGroupData data)
 {
     SavedMonitorFilter = Monitor._configuredFilter;
     SavedMonitorTags   = Monitor._currentTag;
     if ((_unfilteredParent = Monitor._currentUnfiltered) != null)
     {
         _depth = _unfilteredParent._depth + 1;
     }
     else
     {
         _depth = 1;
     }
     // Logs everything when a Group is an error: we then have full details available without
     // logging all with Error or Fatal.
     if (data.MaskedLevel >= LogLevel.Error && Monitor._configuredFilter != LogFilter.Debug)
     {
         Monitor.DoSetConfiguredFilter(LogFilter.Debug);
     }
     _closeLogTime = DateTimeStamp.MinValue;
     _data         = data;
 }
 internal void GroupClosed()
 {
     _data          = null;
     _previousTopic = null;
 }
 /// <summary>
 /// Initializes or reinitializes this group (if it has been disposed) as a filtered group. 
 /// </summary>
 internal void InitializeRejectedGroup( ActivityMonitorGroupData data )
 {
     SavedMonitorFilter = Monitor._configuredFilter;
     SavedMonitorTags = Monitor._currentTag;
     _unfilteredParent = Monitor._currentUnfiltered;
     _depth = 0;
     _data = data;
 }
 internal void GroupClosed()
 {
     _data = null;
     _previousTopic = null;
 }