コード例 #1
0
ファイル: LogGroup.cs プロジェクト: jeremysimmons/sitestarter
        internal void Start()
        {
            if (callingMethod != null && new LogSupervisor().IsEnabled(callingMethod.DeclaringType.Name, LogLevel))
            {
                DiagnosticState.PushGroup(this);

                Write(Summary, LogLevel, CallingMethod);
            }
        }
コード例 #2
0
ファイル: LogGroup.cs プロジェクト: jeremysimmons/sitestarter
        internal void End()
        {
            // Ensure this doesnt run twice for the same group.
            if (!HasEnded)
            {
                LogSupervisor supervisor = new LogSupervisor();

                if (CallingMethod != null && supervisor.IsEnabled(CallingMethod.DeclaringType.Name, LogLevel))
                {
                    // Keep popping groups from the stack until it reaches the correct level
                    // This loop ensures that if a parent group ends before a child group that the child group(s) will be popped
                    // as well and the stack won't become corrupted
                    // TODO: Check if this loop should be moved to DiagnosticState.PopGroup
                    while (supervisor.CanPop(this, DiagnosticState.CurrentGroup))
                    {
                        DiagnosticState.PopGroup();
                    }
                }

                HasEnded = true;
            }
        }