Example #1
0
        public static void Trace(string switchName, params object[] messages)
        {
            LogSwitch logSwitch;

            if (BCLDebug.m_loggingNotEnabled || !BCLDebug.CheckEnabled(switchName, LogLevel.Trace, out logSwitch))
            {
                return;
            }
            StringBuilder sb = StringBuilderCache.Acquire(16);

            for (int index = 0; index < messages.Length; ++index)
            {
                string str;
                try
                {
                    str = messages[index] != null ? messages[index].ToString() : "<null>";
                }
                catch
                {
                    str = "<unable to convert>";
                }
                sb.Append(str);
            }
            sb.Append(Environment.NewLine);
            Log.LogMessage(LoggingLevels.TraceLevel0, logSwitch, StringBuilderCache.GetStringAndRelease(sb));
        }
Example #2
0
        public static void Log(string switchName, LogLevel level, params object[] messages)
        {
            if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
            {
                return;
            }
            if (!BCLDebug.m_registryChecked)
            {
                BCLDebug.CheckRegistry();
            }
            LogSwitch logSwitch;

            if (!BCLDebug.CheckEnabled(switchName, level, out logSwitch))
            {
                return;
            }
            StringBuilder sb = StringBuilderCache.Acquire(16);

            for (int index = 0; index < messages.Length; ++index)
            {
                string str;
                try
                {
                    str = messages[index] != null ? messages[index].ToString() : "<null>";
                }
                catch
                {
                    str = "<unable to convert>";
                }
                sb.Append(str);
            }
            Log.LogMessage((LoggingLevels)level, logSwitch, StringBuilderCache.GetStringAndRelease(sb));
        }
Example #3
0
        public static void Trace(string switchName, string format, params object[] messages)
        {
            LogSwitch logSwitch;

            if (BCLDebug.m_loggingNotEnabled || !BCLDebug.CheckEnabled(switchName, LogLevel.Trace, out logSwitch))
            {
                return;
            }
            StringBuilder sb = StringBuilderCache.Acquire(16);

            sb.AppendFormat(format, messages);
            sb.Append(Environment.NewLine);
            Log.LogMessage(LoggingLevels.TraceLevel0, logSwitch, StringBuilderCache.GetStringAndRelease(sb));
        }
Example #4
0
        public static void DumpStack(string switchName)
        {
            if (!BCLDebug.m_registryChecked)
            {
                BCLDebug.CheckRegistry();
            }
            LogSwitch logSwitch;

            if (!BCLDebug.CheckEnabled(switchName, LogLevel.Trace, out logSwitch))
            {
                return;
            }
            StackTrace stackTrace = new StackTrace();

            Log.LogMessage(LoggingLevels.TraceLevel0, logSwitch, stackTrace.ToString());
        }
        public static void Log(string switchName, LogLevel level, params object[] messages)
        {
            if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
            {
                return;
            }
            if (!BCLDebug.m_registryChecked)
            {
                BCLDebug.CheckRegistry();
            }
            LogSwitch logswitch;

            if (!BCLDebug.CheckEnabled(switchName, level, out logswitch))
            {
                return;
            }
            StringBuilder stringBuilder = StringBuilderCache.Acquire(16);

            for (int i = 0; i < messages.Length; i++)
            {
                string value;
                try
                {
                    if (messages[i] == null)
                    {
                        value = "<null>";
                    }
                    else
                    {
                        value = messages[i].ToString();
                    }
                }
                catch
                {
                    value = "<unable to convert>";
                }
                stringBuilder.Append(value);
            }
            System.Diagnostics.Log.LogMessage((LoggingLevels)level, logswitch, StringBuilderCache.GetStringAndRelease(stringBuilder));
        }
        public static void Trace(string switchName, params object[] messages)
        {
            if (BCLDebug.m_loggingNotEnabled)
            {
                return;
            }
            LogSwitch logswitch;

            if (!BCLDebug.CheckEnabled(switchName, LogLevel.Trace, out logswitch))
            {
                return;
            }
            StringBuilder stringBuilder = StringBuilderCache.Acquire(16);

            for (int i = 0; i < messages.Length; i++)
            {
                string value;
                try
                {
                    if (messages[i] == null)
                    {
                        value = "<null>";
                    }
                    else
                    {
                        value = messages[i].ToString();
                    }
                }
                catch
                {
                    value = "<unable to convert>";
                }
                stringBuilder.Append(value);
            }
            stringBuilder.Append(Environment.NewLine);
            System.Diagnostics.Log.LogMessage(LoggingLevels.TraceLevel0, logswitch, StringBuilderCache.GetStringAndRelease(stringBuilder));
        }