The Labs \ Source Viewer \ SSCLI \ System.Diagnostics \ EventTypeFilter

  1. //------------------------------------------------------------------------------
  2. // <copyright file="SeverityFilter.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System;
  16. namespace System.Diagnostics
  17. {
  18.     public class EventTypeFilter : TraceFilter
  19.     {
  20.         private SourceLevels level;
  21.        
  22.         public EventTypeFilter(SourceLevels level)
  23.         {
  24.             this.level = level;
  25.         }
  26.        
  27.         public override bool ShouldTrace(TraceEventCache cache, string source, TraceEventType eventType, int id, string formatOrMessage, object[] args, object data1, object[] data)
  28.         {
  29.            
  30.             return ((int)eventType & (int)level) != 0;
  31.         }
  32.        
  33.         public SourceLevels EventType {
  34.             get { return level; }
  35.             set { level = value; }
  36.         }
  37.     }
  38. }

Developer Fusion