当前位置: 首页>>代码示例>>C#>>正文


C# Diagnostics.LogSwitch类代码示例

本文整理汇总了C#中System.Diagnostics.LogSwitch的典型用法代码示例。如果您正苦于以下问题:C# LogSwitch类的具体用法?C# LogSwitch怎么用?C# LogSwitch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogSwitch类属于System.Diagnostics命名空间,在下文中一共展示了LogSwitch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogSwitch

 	// Constructs a LogSwitch.  A LogSwitch is used to categorize log messages.
 	// 
 	// All switches (except for the global LogSwitch) have a parent LogSwitch.
 	//
 	/// <include file='doc\LogSwitch.uex' path='docs/doc[@for="LogSwitch.LogSwitch"]/*' />
 	public LogSwitch(String name, String description, LogSwitch parent)
 	{
 		if ((name != null) && (parent != null) )
 		{
 			if (name.Length == 0)
 				throw new ArgumentOutOfRangeException (
 				"Name", Environment.GetResourceString(
 					"Namelength_0"));
 				
 			strName = name;
 			strDescription = description;
 			iLevel = LoggingLevels.ErrorLevel;
 			iOldLevel = iLevel;
 
 			// update the parent switch to reflect this child switch
 			parent.AddChildSwitch (this);
 
 			ParentSwitch = parent;
 
 			ChildSwitch  = null;
 			iNumChildren = 0;
 			iChildArraySize = 0;
 
 			Log.m_Hashtable.Add (strName, this);			
 
 			// Call into the EE to let it know about the creation of
 			// this switch
 			Log.AddLogSwitch (this);
 
 			// update switch count
 			Log.iNumOfSwitches++;
 		}
 		else
 			throw new ArgumentNullException ((name==null ? "name" : "parent"));
 	}
开发者ID:ArildF,项目名称:masters,代码行数:40,代码来源:logswitch.cs

示例2: InvokeLogSwitchLevelHandlers

 internal static void InvokeLogSwitchLevelHandlers(LogSwitch ls, LoggingLevels newLevel)
 {
     LogSwitchLevelHandler handler = _LogSwitchLevelHandler;
     if (handler != null)
     {
         handler(ls, newLevel);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:Log.cs

示例3: LogSwitch

 internal LogSwitch(string name, string description)
 {
     this.strName = name;
     this.strDescription = description;
     this.iLevel = LoggingLevels.ErrorLevel;
     this.iOldLevel = this.iLevel;
     this.ParentSwitch = null;
     this.ChildSwitch = null;
     this.iNumChildren = 0;
     this.iChildArraySize = 0;
     Log.m_Hashtable.Add(this.strName, this);
     Log.AddLogSwitch(this);
     Log.iNumOfSwitches++;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:LogSwitch.cs

示例4: CheckEnabled

 private static bool CheckEnabled(string switchName, LogLevel level, out LogSwitch logSwitch)
 {
     if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
     {
         logSwitch = null;
         return false;
     }
     logSwitch = LogSwitch.GetSwitch(switchName);
     if (logSwitch == null)
     {
         return false;
     }
     return (logSwitch.MinimumLevel <= ((LoggingLevels) ((int) level)));
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:14,代码来源:BCLDebug.cs

示例5: LogSwitch

        [System.Security.SecuritySafeCritical]  // auto-generated
        internal LogSwitch(String name, String description)
        {
            strName = name;
            strDescription = description;
            iLevel = LoggingLevels.ErrorLevel;
            iOldLevel = iLevel;
            ParentSwitch = null;

            Log.m_Hashtable.Add (strName, this); 
    
            // Call into the EE to let it know about the creation of
            // this switch
            Log.AddLogSwitch (this);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:LogSwitch.cs

示例6: Log

     static Log()
     {
         m_Hashtable = new Hashtable();
         m_fConsoleDeviceEnabled = false;
         //pConsole = null;
         //iNumOfMsgHandlers = 0;
         //iMsgHandlerArraySize = 0;
         locker = new Object();
 
         // allocate the GlobalSwitch object
         GlobalSwitch = new LogSwitch ("Global", "Global Switch for this log");
 
         GlobalSwitch.MinimumLevel = LoggingLevels.ErrorLevel;
     }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:14,代码来源:log.cs

示例7: LogSwitch

        [System.Security.SecuritySafeCritical]  // auto-generated
        internal LogSwitch(String name, String description)
        { 
            strName = name;
            strDescription = description; 
            iLevel = LoggingLevels.ErrorLevel; 
            iOldLevel = iLevel;
            ParentSwitch = null; 
            ChildSwitch  = null;
            iNumChildren = 0;
            iChildArraySize = 0;
 
            Log.m_Hashtable.Add (strName, this);
 
            // Call into the EE to let it know about the creation of 
            // this switch
            Log.AddLogSwitch (this); 

            // update switch count
            Log.iNumOfSwitches++;
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:21,代码来源:LogSwitch.cs

示例8: AddChildSwitch

 private void AddChildSwitch(LogSwitch child)
 {
     if (this.iChildArraySize <= this.iNumChildren)
     {
         int num;
         if (this.iChildArraySize == 0)
         {
             num = 10;
         }
         else
         {
             num = (this.iChildArraySize * 3) / 2;
         }
         LogSwitch[] destinationArray = new LogSwitch[num];
         if (this.iNumChildren > 0)
         {
             Array.Copy(this.ChildSwitch, destinationArray, this.iNumChildren);
         }
         this.iChildArraySize = num;
         this.ChildSwitch = destinationArray;
     }
     this.ChildSwitch[this.iNumChildren++] = child;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:LogSwitch.cs

示例9: AddChildSwitch

 	private  void AddChildSwitch (LogSwitch child)
 	{
 		if (iChildArraySize <= iNumChildren)
 		{
 				int iIncreasedSize;
 
 				if (iChildArraySize == 0)
 					iIncreasedSize = 10;
 				else
 					iIncreasedSize = (iChildArraySize * 3) / 2;
 
 				// increase child array size in chunks of 4
 				LogSwitch[] newChildSwitchArray = new LogSwitch [iIncreasedSize];
 
 				// copy the old array objects into the new one.
 	            if (iNumChildren > 0) 
 					Array.Copy(ChildSwitch, newChildSwitchArray, iNumChildren);
 
 				iChildArraySize = iIncreasedSize;
 
 		        ChildSwitch = newChildSwitchArray;
 		}
 
 		ChildSwitch [iNumChildren++] = child;			
 	}
开发者ID:ArildF,项目名称:masters,代码行数:25,代码来源:logswitch.cs

示例10: Error

 public static void Error(LogSwitch logswitch, String message)
 {
     LogMessage (LoggingLevels.ErrorLevel, logswitch, message);
 }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:4,代码来源:log.cs

示例11: Status

 public static void Status(LogSwitch logswitch, String message)
 {
     LogMessage (LoggingLevels.StatusLevel0, logswitch, message);
 }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:4,代码来源:log.cs

示例12: LogMessage

     // Generates a log message. If its switch (or a parent switch) allows the 
     // level for the message, it is "broadcast" to all of the log
     // devices.
     // 
     public static void LogMessage(LoggingLevels level, LogSwitch logswitch, String message)
     {
         if (logswitch == null)
             throw new ArgumentNullException ("LogSwitch");
 
         if (level < 0)
             throw new ArgumentOutOfRangeException("level", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
         Contract.EndContractBlock();
 
         // Is logging for this level for this switch enabled?
         if (logswitch.CheckLevel (level) == true)
         {
             // Send message for logging
             
             // first send it to the debugger
             Debugger.Log ((int) level, logswitch.strName, message);
 
             // Send to the console device
             if (m_fConsoleDeviceEnabled)
             {
                 Console.Write(message);                
             }   
         }
     }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:28,代码来源:log.cs

示例13: LogMessage

 public static void LogMessage(LoggingLevels level, LogSwitch logswitch, string message)
 {
     if (logswitch == null)
     {
         throw new ArgumentNullException("LogSwitch");
     }
     if (level < LoggingLevels.TraceLevel0)
     {
         throw new ArgumentOutOfRangeException("level", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
     }
     if (logswitch.CheckLevel(level))
     {
         Debugger.Log((int) level, logswitch.strName, message);
         if (m_fConsoleDeviceEnabled)
         {
             Console.Write(message);
         }
         for (int i = 0; i < m_iNumOfStreamDevices; i++)
         {
             StreamWriter writer = new StreamWriter(m_rgStream[i]);
             writer.Write(message);
             writer.Flush();
         }
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:25,代码来源:Log.cs

示例14: CheckRegistry

 private static void CheckRegistry()
 {
     if (!AppDomain.CurrentDomain.IsUnloadingForcedFinalize() && !m_registryChecked)
     {
         bool flag;
         bool flag2;
         int num;
         m_registryChecked = true;
         int num2 = GetRegistryLoggingValues(out flag, out flag2, out num, out m_perfWarnings, out m_correctnessWarnings, out m_safeHandleStackTraces);
         if (!flag)
         {
             m_loggingNotEnabled = true;
         }
         if (flag && (levelConversions != null))
         {
             try
             {
                 num = (int) levelConversions[num];
                 if (num2 > 0)
                 {
                     for (int i = 0; i < switches.Length; i++)
                     {
                         if ((switches[i].value & num2) != 0)
                         {
                             LogSwitch switch2 = new LogSwitch(switches[i].name, switches[i].name, System.Diagnostics.Log.GlobalSwitch) {
                                 MinimumLevel = (LoggingLevels) num
                             };
                         }
                     }
                     System.Diagnostics.Log.GlobalSwitch.MinimumLevel = (LoggingLevels) num;
                     System.Diagnostics.Log.IsConsoleEnabled = flag2;
                 }
             }
             catch
             {
             }
         }
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:39,代码来源:BCLDebug.cs

示例15: CheckEnabled

        private static bool CheckEnabled(String switchName, LogLevel level, out LogSwitch logSwitch) {
#if WIN32
			if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
			{
				logSwitch = null;
				return false;
			}
            logSwitch = LogSwitch.GetSwitch(switchName);
            if (logSwitch==null) {
                return false;
            }
            return ((int)logSwitch.MinimumLevel<=(int)level);
#else 
            logSwitch = null;
            return false;
#endif // WIN32
        }
开发者ID:ArildF,项目名称:masters,代码行数:17,代码来源:bcldebug.cs


注:本文中的System.Diagnostics.LogSwitch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。