Exemplo n.º 1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        public void AppendLogNode(LogNode node)
        {
            var currentLog = _anchor.CurrentThreadLog;

            if ( currentLog != null )
            {
                currentLog.AppendNode(node);
            }
            else
            {
                using ( var unknownThreadActivity = new FormattedActivityLogNode(UnknownThreadMessageId, "???") )
                {
                    StartThreadLogNoCheck(ThreadTaskType.Unspecified, unknownThreadActivity);
                    _anchor.CurrentThreadLog.AppendNode(node);
                }
            }

            _plainLog.LogNode(node);

            //if ( node.Level >= LogLevel.Warning )
            //{
            //    PlainLog.LogNode(node);
            //}
        }
Exemplo n.º 2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        internal virtual void AppendChildNode(LogNode child, bool clearFailure = false)
        {
            if ( _isClosed )
            {
                throw new InvalidOperationException("Cannot append log node to a closed activity.");
            }

            base.BubbleLogLevelFrom(child.Level.NoFailureIf(clearFailure));
            base.BubbleContentTypesFrom(child.ContentTypes);

            if ( !clearFailure )
            {
                BubbleExceptionFrom(child.Exception);
            }

            if ( _lastChild != null )
            {
                _lastChild.AttachNextSibling(child);
            }

            _lastChild = child;

            if ( _firstChild == null )
            {
                _firstChild = child;
            }
        }
Exemplo n.º 3
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private void AppendNodeTestString(LogNode node, StringBuilder output)
        {
            output.Append(node is ActivityLogNode ? "A" : "L");
            output.Append(node.Level.ToString().Substring(0, 1));

            if ( node.Exception != null )
            {
                output.Append("X");
            }

            output.Append(":");
            output.Append(node.SingleLineText);
        }
Exemplo n.º 4
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        public void AppendNode(LogNode node, bool clearFailure = false)
        {
            node.AttachToThreadLog(this, _currentActivity);
            _currentActivity.AppendChildNode(node, clearFailure);

            var nodeAsActivity = (node as ActivityLogNode);

            if ( nodeAsActivity != null )
            {
                _currentActivity = nodeAsActivity;
            }
        }
Exemplo n.º 5
0
 //-----------------------------------------------------------------------------------------------------------------------------------------------------
 public void AppendLogNode(LogNode node)
 {
     _logNodes.Add(node);
     node.AttachToThreadLog(_threadLog, parent: null);
 }
Exemplo n.º 6
0
 //-----------------------------------------------------------------------------------------------------------------------------------------------------
 internal void AttachNextSibling(LogNode sibling)
 {
     if ( _nextSibling == null )
     {
         _nextSibling = sibling;
     }
     else
     {
         throw new InvalidOperationException("This log node already has attached sibling node");
     }
 }