Пример #1
0
        /// <summary>
        /// Intialize tracing for a snap-in loaded into MMC.
        /// </summary>
        /// <param name="traceClass"></param>
        public static void InitializeDLL(string traceClass)
        {
            ConfigurationSection section = ConfigurationService.GetSection("system.diagnostics");

            ConfigureListeners(section);
            CtxSwitch configSwitch = CtxSwitch.Create(traceClass, section);

            if (configSwitch != null)
            {
                _CtxSwitch = configSwitch;
            }
        }
Пример #2
0
 public static CtxSwitch Create(string Name, ConfigurationSection configSection)
 {
     foreach (ConfigurationElement ce in configSection.ElementInformation.Properties["switches"].Value as ConfigurationElementCollection) {
         string switchName = ce.ElementInformation.Properties["name"].Value as string;
         string switchValue = ce.ElementInformation.Properties["value"].Value as string;
         if (switchName == Name) {
             CtxSwitch sw = new CtxSwitch (Name);
             sw.Level = GetTraceLevel (switchValue);
             return sw;
         }
     }
     return null;
 }
Пример #3
0
 public static CtxSwitch Create(string Name, ConfigurationSection configSection)
 {
     foreach (ConfigurationElement ce in configSection.ElementInformation.Properties["switches"].Value as ConfigurationElementCollection)
     {
         string switchName  = ce.ElementInformation.Properties["name"].Value as string;
         string switchValue = ce.ElementInformation.Properties["value"].Value as string;
         if (switchName == Name)
         {
             CtxSwitch sw = new CtxSwitch(Name);
             sw.Level = GetTraceLevel(switchValue);
             return(sw);
         }
     }
     return(null);
 }
Пример #4
0
 public static void Initialize(string traceClass, TraceLevel traceLevel)
 {
     _CtxSwitch       = CtxSwitch.Create(traceClass);
     _CtxSwitch.Level = traceLevel;
     CheckListeners(traceClass);
 }
Пример #5
0
 public static void Initialize(string traceClass, bool TraceThreads)
 {
     _CtxSwitch = CtxSwitch.Create(traceClass);
     CheckListeners(traceClass);
     _TraceThreads = TraceThreads;
 }
Пример #6
0
 /// <summary>
 /// Initialize tracing for an application (web or windows). The config file has been loaded automatically so
 /// it just remains to create the appropriate switch
 /// </summary>
 /// <param name="traceClass"></param>
 public static void Initialize(string traceClass)
 {
     _CtxSwitch = CtxSwitch.Create(traceClass);
     CheckListeners(traceClass);
 }
Пример #7
0
 /// <summary>
 /// Intialize tracing for a snap-in loaded into MMC.
 /// </summary>
 /// <param name="traceClass"></param>
 public static void InitializeDLL(string traceClass)
 {
     ConfigurationSection section = ConfigurationService.GetSection ("system.diagnostics");
     ConfigureListeners (section);
     CtxSwitch configSwitch = CtxSwitch.Create (traceClass, section);
     if (configSwitch != null) {
         _CtxSwitch = configSwitch;
     }
 }
Пример #8
0
 public static void Initialize(string traceClass, TraceLevel traceLevel)
 {
     _CtxSwitch = CtxSwitch.Create (traceClass);
     _CtxSwitch.Level = traceLevel;
     CheckListeners (traceClass);
 }
Пример #9
0
 public static void Initialize(string traceClass, bool TraceThreads)
 {
     _CtxSwitch = CtxSwitch.Create (traceClass);
     CheckListeners (traceClass);
     _TraceThreads = TraceThreads;
 }
Пример #10
0
 /// <summary>
 /// Initialize tracing for an application (web or windows). The config file has been loaded automatically so
 /// it just remains to create the appropriate switch
 /// </summary>
 /// <param name="traceClass"></param>
 public static void Initialize(string traceClass)
 {
     _CtxSwitch = CtxSwitch.Create (traceClass);
     CheckListeners (traceClass);
 }