PageRenderTime 57ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/WCFWebApi/src/Microsoft.Server.Common/Microsoft/Server/Common/Diagnostics/DiagnosticTraceSource.cs

#
C# | 43 lines | 36 code | 4 blank | 3 comment | 2 complexity | c7e251594d6c3d04ddbe5863ece79f7e MD5 | raw file
Possible License(s): CC-BY-SA-3.0, Apache-2.0
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace Microsoft.Server.Common.Diagnostics
  5. {
  6. using System.Diagnostics;
  7. public class DiagnosticTraceSource : TraceSource
  8. {
  9. const string PropagateActivityValue = "propagateActivity";
  10. public DiagnosticTraceSource(string name)
  11. : base(name)
  12. {
  13. }
  14. protected override string[] GetSupportedAttributes()
  15. {
  16. return new string[] { DiagnosticTraceSource.PropagateActivityValue };
  17. }
  18. public bool PropagateActivity
  19. {
  20. get
  21. {
  22. bool retval = false;
  23. string attributeValue = this.Attributes[DiagnosticTraceSource.PropagateActivityValue];
  24. if (!string.IsNullOrEmpty(attributeValue))
  25. {
  26. if (!bool.TryParse(attributeValue, out retval))
  27. {
  28. retval = false;
  29. }
  30. }
  31. return retval;
  32. }
  33. set
  34. {
  35. this.Attributes[DiagnosticTraceSource.PropagateActivityValue] = value.ToString();
  36. }
  37. }
  38. }
  39. }