//----------------------------------------------------------------------------------------------------------------------------------------------------- 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); //} }
//----------------------------------------------------------------------------------------------------------------------------------------------------- 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; } }
//----------------------------------------------------------------------------------------------------------------------------------------------------- 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); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- 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; } }
//----------------------------------------------------------------------------------------------------------------------------------------------------- public void AppendLogNode(LogNode node) { _logNodes.Add(node); node.AttachToThreadLog(_threadLog, parent: null); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- internal void AttachNextSibling(LogNode sibling) { if ( _nextSibling == null ) { _nextSibling = sibling; } else { throw new InvalidOperationException("This log node already has attached sibling node"); } }