Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Rules / Tracer.cs / 1305376 / Tracer.cs
// ---------------------------------------------------------------------------- // Copyright (C) 2006 Microsoft Corporation All Rights Reserved // --------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Workflow.ComponentModel; namespace System.Workflow.Activities.Rules { internal class Tracer { private string tracePrefix; // get the localized trace messages once private static string traceRuleIdentifier = Messages.TraceRuleIdentifier; private static string traceRuleHeader = Messages.TraceRuleHeader; private static string traceRuleSetEvaluate = Messages.TraceRuleSetEvaluate; private static string traceRuleEvaluate = Messages.TraceRuleEvaluate; private static string traceRuleResult = Messages.TraceRuleResult; private static string traceRuleActions = Messages.TraceRuleActions; private static string traceCondition = Messages.Condition; private static string traceThen = Messages.Then; private static string traceElse = Messages.Else; private static string traceUpdate = Messages.TraceUpdate; private static string traceRuleTriggers = Messages.TraceRuleTriggers; private static string traceRuleConditionDependency = Messages.TraceRuleConditionDependency; private static string traceRuleActionSideEffect = Messages.TraceRuleActionSideEffect; internal Tracer(string name, ActivityExecutionContext activityExecutionContext) { if (activityExecutionContext != null) tracePrefix = string.Format(CultureInfo.CurrentCulture, traceRuleIdentifier, name, activityExecutionContext.ContextGuid.ToString()); else tracePrefix = string.Format(CultureInfo.CurrentCulture, traceRuleHeader, name); } internal void StartRuleSet() { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Information, 0, traceRuleSetEvaluate, tracePrefix); } internal void StartRule(string ruleName) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceRuleEvaluate, tracePrefix, ruleName); } internal void RuleResult(string ruleName, bool result) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Information, 0, traceRuleResult, tracePrefix, ruleName, result.ToString()); } internal void StartActions(string ruleName, bool result) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceRuleActions, tracePrefix, (result ? traceThen : traceElse), ruleName); } internal void TraceUpdate(string ruleName, string otherName) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceUpdate, tracePrefix, ruleName, otherName); } internal void TraceConditionSymbols(string ruleName, ICollectionsymbols) { TraceRuleSymbols(traceRuleConditionDependency, traceCondition, ruleName, symbols); } internal void TraceThenSymbols(string ruleName, ICollection symbols) { TraceRuleSymbols(traceRuleActionSideEffect, traceThen, ruleName, symbols); } internal void TraceElseSymbols(string ruleName, ICollection symbols) { TraceRuleSymbols(traceRuleActionSideEffect, traceElse, ruleName, symbols); } private void TraceRuleSymbols(string message, string clause, string ruleName, ICollection symbols) { foreach (string symbol in symbols) WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, message, tracePrefix, ruleName, clause, symbol); } internal void TraceThenTriggers(string currentRuleName, ICollection triggeredRules, List ruleStates) { TraceRuleTriggers(traceThen, currentRuleName, triggeredRules, ruleStates); } internal void TraceElseTriggers(string currentRuleName, ICollection triggeredRules, List ruleStates) { TraceRuleTriggers(traceElse, currentRuleName, triggeredRules, ruleStates); } private void TraceRuleTriggers(string thenOrElse, string currentRuleName, ICollection triggeredRules, List ruleStates) { foreach (int r in triggeredRules) WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceRuleTriggers, tracePrefix, currentRuleName, thenOrElse, ruleStates[r].Rule.Name); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- // Copyright (C) 2006 Microsoft Corporation All Rights Reserved // --------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Workflow.ComponentModel; namespace System.Workflow.Activities.Rules { internal class Tracer { private string tracePrefix; // get the localized trace messages once private static string traceRuleIdentifier = Messages.TraceRuleIdentifier; private static string traceRuleHeader = Messages.TraceRuleHeader; private static string traceRuleSetEvaluate = Messages.TraceRuleSetEvaluate; private static string traceRuleEvaluate = Messages.TraceRuleEvaluate; private static string traceRuleResult = Messages.TraceRuleResult; private static string traceRuleActions = Messages.TraceRuleActions; private static string traceCondition = Messages.Condition; private static string traceThen = Messages.Then; private static string traceElse = Messages.Else; private static string traceUpdate = Messages.TraceUpdate; private static string traceRuleTriggers = Messages.TraceRuleTriggers; private static string traceRuleConditionDependency = Messages.TraceRuleConditionDependency; private static string traceRuleActionSideEffect = Messages.TraceRuleActionSideEffect; internal Tracer(string name, ActivityExecutionContext activityExecutionContext) { if (activityExecutionContext != null) tracePrefix = string.Format(CultureInfo.CurrentCulture, traceRuleIdentifier, name, activityExecutionContext.ContextGuid.ToString()); else tracePrefix = string.Format(CultureInfo.CurrentCulture, traceRuleHeader, name); } internal void StartRuleSet() { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Information, 0, traceRuleSetEvaluate, tracePrefix); } internal void StartRule(string ruleName) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceRuleEvaluate, tracePrefix, ruleName); } internal void RuleResult(string ruleName, bool result) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Information, 0, traceRuleResult, tracePrefix, ruleName, result.ToString()); } internal void StartActions(string ruleName, bool result) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceRuleActions, tracePrefix, (result ? traceThen : traceElse), ruleName); } internal void TraceUpdate(string ruleName, string otherName) { WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceUpdate, tracePrefix, ruleName, otherName); } internal void TraceConditionSymbols(string ruleName, ICollection symbols) { TraceRuleSymbols(traceRuleConditionDependency, traceCondition, ruleName, symbols); } internal void TraceThenSymbols(string ruleName, ICollection symbols) { TraceRuleSymbols(traceRuleActionSideEffect, traceThen, ruleName, symbols); } internal void TraceElseSymbols(string ruleName, ICollection symbols) { TraceRuleSymbols(traceRuleActionSideEffect, traceElse, ruleName, symbols); } private void TraceRuleSymbols(string message, string clause, string ruleName, ICollection symbols) { foreach (string symbol in symbols) WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, message, tracePrefix, ruleName, clause, symbol); } internal void TraceThenTriggers(string currentRuleName, ICollection triggeredRules, List ruleStates) { TraceRuleTriggers(traceThen, currentRuleName, triggeredRules, ruleStates); } internal void TraceElseTriggers(string currentRuleName, ICollection triggeredRules, List ruleStates) { TraceRuleTriggers(traceElse, currentRuleName, triggeredRules, ruleStates); } private void TraceRuleTriggers(string thenOrElse, string currentRuleName, ICollection triggeredRules, List ruleStates) { foreach (int r in triggeredRules) WorkflowActivityTrace.Rules.TraceEvent(TraceEventType.Verbose, 0, traceRuleTriggers, tracePrefix, currentRuleName, thenOrElse, ruleStates[r].Rule.Name); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FontWeight.cs
- HandlerFactoryWrapper.cs
- EntitySqlQueryBuilder.cs
- XPathScanner.cs
- CaseInsensitiveComparer.cs
- TabControl.cs
- GeneratedCodeAttribute.cs
- SQLMoney.cs
- Table.cs
- XmlHelper.cs
- DataGridViewRowStateChangedEventArgs.cs
- FactoryId.cs
- TrackingRecord.cs
- Graph.cs
- SelectionRange.cs
- ToolStripContentPanelRenderEventArgs.cs
- RemotingAttributes.cs
- UrlAuthorizationModule.cs
- AutoResetEvent.cs
- SqlNotificationRequest.cs
- RawUIStateInputReport.cs
- ComponentDispatcherThread.cs
- DecoderFallbackWithFailureFlag.cs
- TextRangeProviderWrapper.cs
- DesignerActionTextItem.cs
- Relationship.cs
- ControlsConfig.cs
- SqlMethods.cs
- AstTree.cs
- WsdlInspector.cs
- panel.cs
- TypeConstant.cs
- OdbcConnectionString.cs
- FunctionParameter.cs
- SqlXml.cs
- QuaternionRotation3D.cs
- TypeSemantics.cs
- Transform3DGroup.cs
- FileCodeGroup.cs
- SparseMemoryStream.cs
- ListDataBindEventArgs.cs
- List.cs
- WmlSelectionListAdapter.cs
- ArrayTypeMismatchException.cs
- BitmapEffectState.cs
- NumberFunctions.cs
- UInt32Converter.cs
- EventLogEntryCollection.cs
- TraceContextRecord.cs
- ReferenceEqualityComparer.cs
- WebContext.cs
- MouseButton.cs
- DelimitedListTraceListener.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- EntityKeyElement.cs
- TypographyProperties.cs
- GraphicsState.cs
- ButtonChrome.cs
- TableLayout.cs
- VariableElement.cs
- ChildTable.cs
- TypeDependencyAttribute.cs
- XmlQueryType.cs
- ControlAdapter.cs
- DataStreams.cs
- ReferenceTypeElement.cs
- ObjectDataSourceDisposingEventArgs.cs
- AnnotationAuthorChangedEventArgs.cs
- SecurityTokenException.cs
- ClientScriptManagerWrapper.cs
- HttpServerChannel.cs
- InputLanguageEventArgs.cs
- RuleSetBrowserDialog.cs
- ConvertEvent.cs
- XhtmlTextWriter.cs
- JsonReader.cs
- IdentifierService.cs
- CompleteWizardStep.cs
- FilterableAttribute.cs
- TypeExtensionConverter.cs
- NavigationFailedEventArgs.cs
- NumberFunctions.cs
- Invariant.cs
- Enumerable.cs
- WSSecurityOneDotOneSendSecurityHeader.cs
- TimeSpanValidatorAttribute.cs
- SettingsPropertyWrongTypeException.cs
- TrustLevelCollection.cs
- UpdateTranslator.cs
- ByteKeyFrameCollection.cs
- mongolianshape.cs
- SapiGrammar.cs
- TabControlAutomationPeer.cs
- PathFigure.cs
- Win32Native.cs
- AutoScrollExpandMessageFilter.cs
- TraceInternal.cs
- PresentationAppDomainManager.cs
- WhiteSpaceTrimStringConverter.cs
- WebConfigurationHost.cs