// 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")); }
internal static void InvokeLogSwitchLevelHandlers(LogSwitch ls, LoggingLevels newLevel) { LogSwitchLevelHandler handler = _LogSwitchLevelHandler; if (handler != null) { handler(ls, newLevel); } }
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++; }
[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); }
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; }
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))); }
[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++; }
[System.Security.SecuritySafeCritical] // auto-generated public LogSwitch(String name, String description, LogSwitch parent) { if (name != null && name.Length == 0) throw new ArgumentOutOfRangeException("Name", Environment.GetResourceString("Argument_StringZeroLength")); Contract.EndContractBlock(); if ((name != null) && (parent != null)) { strName = name; strDescription = description; iLevel = LoggingLevels.ErrorLevel; iOldLevel = iLevel; ParentSwitch = parent; Log.m_Hashtable.Add (strName, this); // Call into the EE to let it know about the creation of // this switch Log.AddLogSwitch (this); } else throw new ArgumentNullException ((name==null ? "name" : "parent")); }
public LogSwitch(string name, string description, LogSwitch parent) { if ((name != null) && (name.Length == 0)) { throw new ArgumentOutOfRangeException("Name", Environment.GetResourceString("Argument_StringZeroLength")); } if ((name == null) || (parent == null)) { throw new ArgumentNullException((name == null) ? "name" : "parent"); } this.strName = name; this.strDescription = description; this.iLevel = LoggingLevels.ErrorLevel; this.iOldLevel = this.iLevel; parent.AddChildSwitch(this); this.ParentSwitch = parent; this.ChildSwitch = null; this.iNumChildren = 0; this.iChildArraySize = 0; Log.m_Hashtable.Add(this.strName, this); Log.AddLogSwitch(this); Log.iNumOfSwitches++; }
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; }
public LogSwitch(string name, string description, LogSwitch parent) { if ((name != null) && (name.Length == 0)) { throw new ArgumentOutOfRangeException("Name", Environment.GetResourceString("Argument_StringZeroLength")); } if ((name == null) || (parent == null)) { throw new ArgumentNullException((name == null) ? "name" : "parent"); } this.strName = name; this.strDescription = description; this.iLevel = LoggingLevels.ErrorLevel; this.iOldLevel = this.iLevel; parent.AddChildSwitch(this); this.ParentSwitch = parent; this.ChildSwitch = null; this.iNumChildren = 0; this.iChildArraySize = 0; Log.m_Hashtable.Add(this.strName, this); Log.AddLogSwitch(this); Log.iNumOfSwitches++; }
// Constructs a LogSwitch. A LogSwitch is used to categorize log messages. // // All switches (except for the global LogSwitch) have a parent LogSwitch. // public LogSwitch(String name, String description, LogSwitch parent) { if ((name != null) && (parent != null)) { if (name.Length == 0) { throw new ArgumentOutOfRangeException("Name", Environment.GetResourceString("Argument_StringZeroLength")); } 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")); } }
// 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. // /// <include file='doc\log.uex' path='docs/doc[@for="Log.LogMessage1"]/*' /> 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")); } // Is logging for this level for this switch enabled? if (logswitch.CheckLevel(level) == true) { // Send message for logging // first send it to the debugger // @COOLPORT: Why This cast? Debugger.Log((int)level, logswitch.strName, message); // Send to the console device if (m_fConsoleDeviceEnabled) { Console.Write(message); } // Send it to the streams for (int i = 0; i < m_iNumOfStreamDevices; i++) { StreamWriter sw = new StreamWriter(m_rgStream[i]); sw.Write(message); sw.Flush(); } } }
internal static extern void AddLogSwitch(LogSwitch logSwitch);
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 { } } } }
public static void Warning(LogSwitch logswitch, String message) { LogMessage (LoggingLevels.WarningLevel, logswitch, message); }
public static void Error(LogSwitch logswitch, String message) { LogMessage (LoggingLevels.ErrorLevel, logswitch, message); }
/* * Following are convenience entry points; all go through Log() * Note that the (Switch switch, String message) variations * are preferred. */ public static void Trace(LogSwitch logswitch, String message) { LogMessage (LoggingLevels.TraceLevel0, logswitch, message); }
public static void Status(LogSwitch logswitch, String message) { LogMessage (LoggingLevels.StatusLevel0, logswitch, message); }
/* * Following are convenience entry points; all go through Log() * Note that the (Switch switch, String message) variations * are preferred. */ /// <include file='doc\log.uex' path='docs/doc[@for="Log.Trace"]/*' /> public static void Trace(LogSwitch logswitch, String message) { LogMessage(LoggingLevels.TraceLevel0, logswitch, message); }
internal static void InvokeLogSwitchLevelHandlers (LogSwitch ls, LoggingLevels newLevel) { if (_LogSwitchLevelHandler != null) _LogSwitchLevelHandler(ls, newLevel); }
public static void Trace(string switchname, string message) { Log.LogMessage(LoggingLevels.TraceLevel0, LogSwitch.GetSwitch(switchname), message); }
public static void Error(string switchname, string message) { Log.LogMessage(LoggingLevels.ErrorLevel, LogSwitch.GetSwitch(switchname), message); }
/// <include file='doc\log.uex' path='docs/doc[@for="Log.Panic"]/*' /> public static void Panic(LogSwitch logswitch, String message) { LogMessage(LoggingLevels.PanicLevel, logswitch, message); }
/// <include file='doc\log.uex' path='docs/doc[@for="Log.Warning"]/*' /> public static void Warning(LogSwitch logswitch, String message) { LogMessage(LoggingLevels.WarningLevel, logswitch, message); }
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 }
/// <include file='doc\log.uex' path='docs/doc[@for="Log.Panic"]/*' /> public static void Panic(LogSwitch logswitch, String message) { LogMessage (LoggingLevels.PanicLevel, logswitch, message); }
// 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. // /// <include file='doc\log.uex' path='docs/doc[@for="Log.LogMessage1"]/*' /> 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")); // 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); } // Send it to the streams for (int i=0; i<m_iNumOfStreamDevices; i++) { StreamWriter sw = new StreamWriter(m_rgStream[i]); sw.Write(message); sw.Flush(); } } }
public static void Status(string switchname, string message) { Log.LogMessage(LoggingLevels.StatusLevel0, LogSwitch.GetSwitch(switchname), message); }
// Token: 0x06003229 RID: 12841 RVA: 0x000C06F4 File Offset: 0x000BE8F4 public static void Warning(string switchname, string message) { LogSwitch @switch = LogSwitch.GetSwitch(switchname); Log.LogMessage(LoggingLevels.WarningLevel, @switch, message); }
private static void CheckRegistry() { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) return; if (m_registryChecked) { return; } m_registryChecked = true; bool loggingEnabled; bool logToConsole; int logLevel; int facilityValue; facilityValue = GetRegistryLoggingValues(out loggingEnabled, out logToConsole, out logLevel, out m_perfWarnings, out m_correctnessWarnings, out m_safeHandleStackTraces); // Note we can get into some recursive situations where we call // ourseves recursively through the .cctor. That's why we have the // check for levelConversions == null. if (!loggingEnabled) { m_loggingNotEnabled = true; } if (loggingEnabled && levelConversions!=null) { try { //The values returned for the logging levels in the registry don't map nicely onto the //values which we support internally (which are an approximation of the ones that //the System.Diagnostics namespace uses) so we have a quick map. Assert(logLevel>=0 && logLevel<=10, "logLevel>=0 && logLevel<=10"); logLevel = (int)levelConversions[logLevel]; if (facilityValue>0) { for (int i=0; i<switches.Length; i++) { if ((switches[i].value & facilityValue)!=0) { LogSwitch L = new LogSwitch(switches[i].name, switches[i].name, System.Diagnostics.Log.GlobalSwitch); L.MinimumLevel = (LoggingLevels)logLevel; } } System.Diagnostics.Log.GlobalSwitch.MinimumLevel = (LoggingLevels)logLevel; System.Diagnostics.Log.IsConsoleEnabled = logToConsole; } } catch { //Silently eat any exceptions. } } }
// 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); } } }
/// <include file='doc\log.uex' path='docs/doc[@for="Log.Status"]/*' /> public static void Status(LogSwitch logswitch, String message) { LogMessage(LoggingLevels.StatusLevel0, logswitch, message); }
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(); } } }
/// <include file='doc\log.uex' path='docs/doc[@for="Log.Error"]/*' /> public static void Error(LogSwitch logswitch, String message) { LogMessage(LoggingLevels.ErrorLevel, logswitch, message); }
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; }
internal static extern void AddLogSwitch(LogSwitch logSwitch);
private static void CheckRegistry() { if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize()) { return; } if (BCLDebug.m_registryChecked) { return; } BCLDebug.m_registryChecked = true; bool flag; bool isConsoleEnabled; int num; int registryLoggingValues = BCLDebug.GetRegistryLoggingValues(out flag, out isConsoleEnabled, out num, out BCLDebug.m_perfWarnings, out BCLDebug.m_correctnessWarnings, out BCLDebug.m_safeHandleStackTraces); if (!flag) { BCLDebug.m_loggingNotEnabled = true; } if (flag && BCLDebug.levelConversions != null) { try { num = (int)BCLDebug.levelConversions[num]; if (registryLoggingValues > 0) { for (int i = 0; i < BCLDebug.switches.Length; i++) { if ((BCLDebug.switches[i].value & registryLoggingValues) != 0) { LogSwitch logSwitch = new LogSwitch(BCLDebug.switches[i].name, BCLDebug.switches[i].name, System.Diagnostics.Log.GlobalSwitch); logSwitch.MinimumLevel = (LoggingLevels)num; } } System.Diagnostics.Log.GlobalSwitch.MinimumLevel = (LoggingLevels)num; System.Diagnostics.Log.IsConsoleEnabled = isConsoleEnabled; } } catch { } } }