diff options
Diffstat (limited to 'src/DotNetOpenAuth.Core/Loggers')
-rw-r--r-- | src/DotNetOpenAuth.Core/Loggers/ILog.cs | 851 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Core/Loggers/Log4NetLogger.cs | 219 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Core/Loggers/NLogLogger.cs | 222 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Core/Loggers/NoOpLogger.cs | 159 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Core/Loggers/TraceLogger.cs | 357 |
5 files changed, 0 insertions, 1808 deletions
diff --git a/src/DotNetOpenAuth.Core/Loggers/ILog.cs b/src/DotNetOpenAuth.Core/Loggers/ILog.cs deleted file mode 100644 index e801b2a..0000000 --- a/src/DotNetOpenAuth.Core/Loggers/ILog.cs +++ /dev/null @@ -1,851 +0,0 @@ -// <auto-generated /> - -#region Copyright & License -// -// Copyright 2001-2006 The Apache Software Foundation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#endregion - -// This interface is designed to look like log4net's ILog interface. -// We have this as a facade in front of it to avoid crashing if the -// hosting web site chooses not to deploy log4net.dll along with -// DotNetOpenAuth.dll. - -namespace DotNetOpenAuth.Loggers -{ - using System; - using System.Reflection; - using log4net; - using log4net.Core; - - /// <summary> - /// The ILog interface is use by application to log messages into - /// the log4net framework. - /// </summary> - /// <remarks> - /// <para> - /// Use the <see cref="LogManager"/> to obtain logger instances - /// that implement this interface. The <see cref="LogManager.GetLogger(Assembly,Type)"/> - /// static method is used to get logger instances. - /// </para> - /// <para> - /// This class contains methods for logging at different levels and also - /// has properties for determining if those logging levels are - /// enabled in the current configuration. - /// </para> - /// <para> - /// This interface can be implemented in different ways. This documentation - /// specifies reasonable behavior that a caller can expect from the actual - /// implementation, however different implementations reserve the right to - /// do things differently. - /// </para> - /// </remarks> - /// <example>Simple example of logging messages - /// <code lang="C#"> - /// ILog log = LogManager.GetLogger("application-log"); - /// - /// log.Info("Application Start"); - /// log.Debug("This is a debug message"); - /// - /// if (log.IsDebugEnabled) - /// { - /// log.Debug("This is another debug message"); - /// } - /// </code> - /// </example> - /// <seealso cref="LogManager"/> - /// <seealso cref="LogManager.GetLogger(Assembly, Type)"/> - /// <author>Nicko Cadell</author> - /// <author>Gert Driesen</author> - interface ILog - { - /// <overloads>Log a message object with the <see cref="Level.Debug"/> level.</overloads> - /// <summary> - /// Log a message object with the <see cref="Level.Debug"/> level. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <remarks> - /// <para> - /// This method first checks if this logger is <c>DEBUG</c> - /// enabled by comparing the level of this logger with the - /// <see cref="Level.Debug"/> level. If this logger is - /// <c>DEBUG</c> enabled, then it converts the message object - /// (passed as parameter) to a string by invoking the appropriate - /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then - /// proceeds to call all the registered appenders in this logger - /// and also higher in the hierarchy depending on the value of - /// the additivity flag. - /// </para> - /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> - /// to this method will print the name of the <see cref="Exception"/> - /// but no stack trace. To print a stack trace use the - /// <see cref="Debug(object,Exception)"/> form instead. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object,Exception)"/> - /// <seealso cref="IsDebugEnabled"/> - void Debug(object message); - - /// <summary> - /// Log a message object with the <see cref="Level.Debug"/> level including - /// the stack trace of the <see cref="Exception"/> passed - /// as a parameter. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <param name="exception">The exception to log, including its stack trace.</param> - /// <remarks> - /// <para> - /// See the <see cref="Debug(object)"/> form for more detailed information. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object)"/> - /// <seealso cref="IsDebugEnabled"/> - void Debug(object message, Exception exception); - - /// <overloads>Log a formatted string with the <see cref="Level.Debug"/> level.</overloads> - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Debug"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="args">An Object array containing zero or more objects to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object)"/> - /// <seealso cref="IsDebugEnabled"/> - void DebugFormat(string format, params object[] args); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Debug"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object)"/> - /// <seealso cref="IsDebugEnabled"/> - void DebugFormat(string format, object arg0); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Debug"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object)"/> - /// <seealso cref="IsDebugEnabled"/> - void DebugFormat(string format, object arg0, object arg1); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Debug"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <param name="arg2">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object)"/> - /// <seealso cref="IsDebugEnabled"/> - void DebugFormat(string format, object arg0, object arg1, object arg2); - - /// <overloads>Log a message object with the <see cref="Level.Info"/> level.</overloads> - /// <summary> - /// Logs a message object with the <see cref="Level.Info"/> level. - /// </summary> - /// <remarks> - /// <para> - /// This method first checks if this logger is <c>INFO</c> - /// enabled by comparing the level of this logger with the - /// <see cref="Level.Info"/> level. If this logger is - /// <c>INFO</c> enabled, then it converts the message object - /// (passed as parameter) to a string by invoking the appropriate - /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then - /// proceeds to call all the registered appenders in this logger - /// and also higher in the hierarchy depending on the value of the - /// additivity flag. - /// </para> - /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> - /// to this method will print the name of the <see cref="Exception"/> - /// but no stack trace. To print a stack trace use the - /// <see cref="Info(object,Exception)"/> form instead. - /// </para> - /// </remarks> - /// <param name="message">The message object to log.</param> - /// <seealso cref="Info(object,Exception)"/> - /// <seealso cref="IsInfoEnabled"/> - void Info(object message); - - /// <summary> - /// Logs a message object with the <c>INFO</c> level including - /// the stack trace of the <see cref="Exception"/> passed - /// as a parameter. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <param name="exception">The exception to log, including its stack trace.</param> - /// <remarks> - /// <para> - /// See the <see cref="Info(object)"/> form for more detailed information. - /// </para> - /// </remarks> - /// <seealso cref="Info(object)"/> - /// <seealso cref="IsInfoEnabled"/> - void Info(object message, Exception exception); - - /// <overloads>Log a formatted message string with the <see cref="Level.Info"/> level.</overloads> - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Info"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="args">An Object array containing zero or more objects to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Info(object,Exception)"/> - /// <seealso cref="IsInfoEnabled"/> - void InfoFormat(string format, params object[] args); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Info"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Info(object)"/> - /// <seealso cref="IsInfoEnabled"/> - void InfoFormat(string format, object arg0); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Info"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Info(object)"/> - /// <seealso cref="IsInfoEnabled"/> - void InfoFormat(string format, object arg0, object arg1); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Info"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <param name="arg2">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Info(object)"/> - /// <seealso cref="IsInfoEnabled"/> - void InfoFormat(string format, object arg0, object arg1, object arg2); - - /// <overloads>Log a message object with the <see cref="Level.Warn"/> level.</overloads> - /// <summary> - /// Log a message object with the <see cref="Level.Warn"/> level. - /// </summary> - /// <remarks> - /// <para> - /// This method first checks if this logger is <c>WARN</c> - /// enabled by comparing the level of this logger with the - /// <see cref="Level.Warn"/> level. If this logger is - /// <c>WARN</c> enabled, then it converts the message object - /// (passed as parameter) to a string by invoking the appropriate - /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then - /// proceeds to call all the registered appenders in this logger - /// and also higher in the hierarchy depending on the value of the - /// additivity flag. - /// </para> - /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> - /// to this method will print the name of the <see cref="Exception"/> - /// but no stack trace. To print a stack trace use the - /// <see cref="Warn(object,Exception)"/> form instead. - /// </para> - /// </remarks> - /// <param name="message">The message object to log.</param> - /// <seealso cref="Warn(object,Exception)"/> - /// <seealso cref="IsWarnEnabled"/> - void Warn(object message); - - /// <summary> - /// Log a message object with the <see cref="Level.Warn"/> level including - /// the stack trace of the <see cref="Exception"/> passed - /// as a parameter. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <param name="exception">The exception to log, including its stack trace.</param> - /// <remarks> - /// <para> - /// See the <see cref="Warn(object)"/> form for more detailed information. - /// </para> - /// </remarks> - /// <seealso cref="Warn(object)"/> - /// <seealso cref="IsWarnEnabled"/> - void Warn(object message, Exception exception); - - /// <overloads>Log a formatted message string with the <see cref="Level.Warn"/> level.</overloads> - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Warn"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="args">An Object array containing zero or more objects to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Warn(object,Exception)"/> - /// <seealso cref="IsWarnEnabled"/> - void WarnFormat(string format, params object[] args); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Warn"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Warn(object)"/> - /// <seealso cref="IsWarnEnabled"/> - void WarnFormat(string format, object arg0); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Warn"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Warn(object)"/> - /// <seealso cref="IsWarnEnabled"/> - void WarnFormat(string format, object arg0, object arg1); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Warn"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <param name="arg2">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Warn(object)"/> - /// <seealso cref="IsWarnEnabled"/> - void WarnFormat(string format, object arg0, object arg1, object arg2); - - /// <overloads>Log a message object with the <see cref="Level.Error"/> level.</overloads> - /// <summary> - /// Logs a message object with the <see cref="Level.Error"/> level. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <remarks> - /// <para> - /// This method first checks if this logger is <c>ERROR</c> - /// enabled by comparing the level of this logger with the - /// <see cref="Level.Error"/> level. If this logger is - /// <c>ERROR</c> enabled, then it converts the message object - /// (passed as parameter) to a string by invoking the appropriate - /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then - /// proceeds to call all the registered appenders in this logger - /// and also higher in the hierarchy depending on the value of the - /// additivity flag. - /// </para> - /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> - /// to this method will print the name of the <see cref="Exception"/> - /// but no stack trace. To print a stack trace use the - /// <see cref="Error(object,Exception)"/> form instead. - /// </para> - /// </remarks> - /// <seealso cref="Error(object,Exception)"/> - /// <seealso cref="IsErrorEnabled"/> - void Error(object message); - - /// <summary> - /// Log a message object with the <see cref="Level.Error"/> level including - /// the stack trace of the <see cref="Exception"/> passed - /// as a parameter. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <param name="exception">The exception to log, including its stack trace.</param> - /// <remarks> - /// <para> - /// See the <see cref="Error(object)"/> form for more detailed information. - /// </para> - /// </remarks> - /// <seealso cref="Error(object)"/> - /// <seealso cref="IsErrorEnabled"/> - void Error(object message, Exception exception); - - /// <overloads>Log a formatted message string with the <see cref="Level.Error"/> level.</overloads> - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Error"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="args">An Object array containing zero or more objects to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Error(object,Exception)"/> - /// <seealso cref="IsErrorEnabled"/> - void ErrorFormat(string format, params object[] args); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Error"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Error(object)"/> - /// <seealso cref="IsErrorEnabled"/> - void ErrorFormat(string format, object arg0); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Error"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Error(object)"/> - /// <seealso cref="IsErrorEnabled"/> - void ErrorFormat(string format, object arg0, object arg1); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Error"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <param name="arg2">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Error(object)"/> - /// <seealso cref="IsErrorEnabled"/> - void ErrorFormat(string format, object arg0, object arg1, object arg2); - - /// <overloads>Log a message object with the <see cref="Level.Fatal"/> level.</overloads> - /// <summary> - /// Log a message object with the <see cref="Level.Fatal"/> level. - /// </summary> - /// <remarks> - /// <para> - /// This method first checks if this logger is <c>FATAL</c> - /// enabled by comparing the level of this logger with the - /// <see cref="Level.Fatal"/> level. If this logger is - /// <c>FATAL</c> enabled, then it converts the message object - /// (passed as parameter) to a string by invoking the appropriate - /// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then - /// proceeds to call all the registered appenders in this logger - /// and also higher in the hierarchy depending on the value of the - /// additivity flag. - /// </para> - /// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> - /// to this method will print the name of the <see cref="Exception"/> - /// but no stack trace. To print a stack trace use the - /// <see cref="Fatal(object,Exception)"/> form instead. - /// </para> - /// </remarks> - /// <param name="message">The message object to log.</param> - /// <seealso cref="Fatal(object,Exception)"/> - /// <seealso cref="IsFatalEnabled"/> - void Fatal(object message); - - /// <summary> - /// Log a message object with the <see cref="Level.Fatal"/> level including - /// the stack trace of the <see cref="Exception"/> passed - /// as a parameter. - /// </summary> - /// <param name="message">The message object to log.</param> - /// <param name="exception">The exception to log, including its stack trace.</param> - /// <remarks> - /// <para> - /// See the <see cref="Fatal(object)"/> form for more detailed information. - /// </para> - /// </remarks> - /// <seealso cref="Fatal(object)"/> - /// <seealso cref="IsFatalEnabled"/> - void Fatal(object message, Exception exception); - - /// <overloads>Log a formatted message string with the <see cref="Level.Fatal"/> level.</overloads> - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="args">An Object array containing zero or more objects to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Fatal(object,Exception)"/> - /// <seealso cref="IsFatalEnabled"/> - void FatalFormat(string format, params object[] args); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Fatal(object)"/> - /// <seealso cref="IsFatalEnabled"/> - void FatalFormat(string format, object arg0); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Fatal(object)"/> - /// <seealso cref="IsFatalEnabled"/> - void FatalFormat(string format, object arg0, object arg1); - - /// <summary> - /// Logs a formatted message string with the <see cref="Level.Fatal"/> level. - /// </summary> - /// <param name="format">A String containing zero or more format items</param> - /// <param name="arg0">An Object to format</param> - /// <param name="arg1">An Object to format</param> - /// <param name="arg2">An Object to format</param> - /// <remarks> - /// <para> - /// The message is formatted using the <c>string.Format</c> method. See - /// <see cref="string.Format(string, object[])"/> for details of the syntax of the format string and the behavior - /// of the formatting. - /// </para> - /// <para> - /// This method does not take an <see cref="Exception"/> object to include in the - /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal(object,Exception)"/> - /// methods instead. - /// </para> - /// </remarks> - /// <seealso cref="Fatal(object)"/> - /// <seealso cref="IsFatalEnabled"/> - void FatalFormat(string format, object arg0, object arg1, object arg2); - - /// <summary> - /// Checks if this logger is enabled for the <see cref="Level.Debug"/> level. - /// </summary> - /// <value> - /// <c>true</c> if this logger is enabled for <see cref="Level.Debug"/> events, <c>false</c> otherwise. - /// </value> - /// <remarks> - /// <para> - /// This function is intended to lessen the computational cost of - /// disabled log debug statements. - /// </para> - /// <para> For some ILog interface <c>log</c>, when you write:</para> - /// <code lang="C#"> - /// log.Debug("This is entry number: " + i ); - /// </code> - /// <para> - /// You incur the cost constructing the message, string construction and concatenation in - /// this case, regardless of whether the message is logged or not. - /// </para> - /// <para> - /// If you are worried about speed (who isn't), then you should write: - /// </para> - /// <code lang="C#"> - /// if (log.IsDebugEnabled) - /// { - /// log.Debug("This is entry number: " + i ); - /// } - /// </code> - /// <para> - /// This way you will not incur the cost of parameter - /// construction if debugging is disabled for <c>log</c>. On - /// the other hand, if the <c>log</c> is debug enabled, you - /// will incur the cost of evaluating whether the logger is debug - /// enabled twice. Once in <see cref="IsDebugEnabled"/> and once in - /// the <see cref="Debug(object)"/>. This is an insignificant overhead - /// since evaluating a logger takes about 1% of the time it - /// takes to actually log. This is the preferred style of logging. - /// </para> - /// <para>Alternatively if your logger is available statically then the is debug - /// enabled state can be stored in a static variable like this: - /// </para> - /// <code lang="C#"> - /// private static readonly bool isDebugEnabled = log.IsDebugEnabled; - /// </code> - /// <para> - /// Then when you come to log you can write: - /// </para> - /// <code lang="C#"> - /// if (isDebugEnabled) - /// { - /// log.Debug("This is entry number: " + i ); - /// } - /// </code> - /// <para> - /// This way the debug enabled state is only queried once - /// when the class is loaded. Using a <c>private static readonly</c> - /// variable is the most efficient because it is a run time constant - /// and can be heavily optimized by the JIT compiler. - /// </para> - /// <para> - /// Of course if you use a static readonly variable to - /// hold the enabled state of the logger then you cannot - /// change the enabled state at runtime to vary the logging - /// that is produced. You have to decide if you need absolute - /// speed or runtime flexibility. - /// </para> - /// </remarks> - /// <seealso cref="Debug(object)"/> - bool IsDebugEnabled { get; } - - /// <summary> - /// Checks if this logger is enabled for the <see cref="Level.Info"/> level. - /// </summary> - /// <value> - /// <c>true</c> if this logger is enabled for <see cref="Level.Info"/> events, <c>false</c> otherwise. - /// </value> - /// <remarks> - /// For more information see <see cref="ILog.IsDebugEnabled"/>. - /// </remarks> - /// <seealso cref="Info(object)"/> - /// <seealso cref="ILog.IsDebugEnabled"/> - bool IsInfoEnabled { get; } - - /// <summary> - /// Checks if this logger is enabled for the <see cref="Level.Warn"/> level. - /// </summary> - /// <value> - /// <c>true</c> if this logger is enabled for <see cref="Level.Warn"/> events, <c>false</c> otherwise. - /// </value> - /// <remarks> - /// For more information see <see cref="ILog.IsDebugEnabled"/>. - /// </remarks> - /// <seealso cref="Warn(object)"/> - /// <seealso cref="ILog.IsDebugEnabled"/> - bool IsWarnEnabled { get; } - - /// <summary> - /// Checks if this logger is enabled for the <see cref="Level.Error"/> level. - /// </summary> - /// <value> - /// <c>true</c> if this logger is enabled for <see cref="Level.Error"/> events, <c>false</c> otherwise. - /// </value> - /// <remarks> - /// For more information see <see cref="ILog.IsDebugEnabled"/>. - /// </remarks> - /// <seealso cref="Error(object)"/> - /// <seealso cref="ILog.IsDebugEnabled"/> - bool IsErrorEnabled { get; } - - /// <summary> - /// Checks if this logger is enabled for the <see cref="Level.Fatal"/> level. - /// </summary> - /// <value> - /// <c>true</c> if this logger is enabled for <see cref="Level.Fatal"/> events, <c>false</c> otherwise. - /// </value> - /// <remarks> - /// For more information see <see cref="ILog.IsDebugEnabled"/>. - /// </remarks> - /// <seealso cref="Fatal(object)"/> - /// <seealso cref="ILog.IsDebugEnabled"/> - bool IsFatalEnabled { get; } - } -} diff --git a/src/DotNetOpenAuth.Core/Loggers/Log4NetLogger.cs b/src/DotNetOpenAuth.Core/Loggers/Log4NetLogger.cs deleted file mode 100644 index 01da034..0000000 --- a/src/DotNetOpenAuth.Core/Loggers/Log4NetLogger.cs +++ /dev/null @@ -1,219 +0,0 @@ -// <auto-generated /> - -namespace DotNetOpenAuth.Loggers { - using System; - using System.Globalization; - using System.IO; - using System.Reflection; - - internal class Log4NetLogger : ILog { - private log4net.ILog log4netLogger; - - private Log4NetLogger(log4net.ILog logger) { - this.log4netLogger = logger; - } - - #region ILog Members - - public bool IsDebugEnabled { - get { return this.log4netLogger.IsDebugEnabled; } - } - - public bool IsInfoEnabled { - get { return this.log4netLogger.IsInfoEnabled; } - } - - public bool IsWarnEnabled { - get { return this.log4netLogger.IsWarnEnabled; } - } - - public bool IsErrorEnabled { - get { return this.log4netLogger.IsErrorEnabled; } - } - - public bool IsFatalEnabled { - get { return this.log4netLogger.IsFatalEnabled; } - } - - #endregion - - private static bool IsLog4NetPresent { - get { - try { - Assembly.Load("log4net"); - return true; - } catch (FileNotFoundException) { - return false; - } - } - } - - #region ILog methods - - public void Debug(object message) { - this.log4netLogger.Debug(message); - } - - public void Debug(object message, Exception exception) { - this.log4netLogger.Debug(message, exception); - } - - public void DebugFormat(string format, params object[] args) { - this.log4netLogger.DebugFormat(CultureInfo.InvariantCulture, format, args); - } - - public void DebugFormat(string format, object arg0) { - this.log4netLogger.DebugFormat(format, arg0); - } - - public void DebugFormat(string format, object arg0, object arg1) { - this.log4netLogger.DebugFormat(format, arg0, arg1); - } - - public void DebugFormat(string format, object arg0, object arg1, object arg2) { - this.log4netLogger.DebugFormat(format, arg0, arg1, arg2); - } - - public void DebugFormat(IFormatProvider provider, string format, params object[] args) { - this.log4netLogger.DebugFormat(provider, format, args); - } - - public void Info(object message) { - this.log4netLogger.Info(message); - } - - public void Info(object message, Exception exception) { - this.log4netLogger.Info(message, exception); - } - - public void InfoFormat(string format, params object[] args) { - this.log4netLogger.InfoFormat(CultureInfo.InvariantCulture, format, args); - } - - public void InfoFormat(string format, object arg0) { - this.log4netLogger.InfoFormat(format, arg0); - } - - public void InfoFormat(string format, object arg0, object arg1) { - this.log4netLogger.InfoFormat(format, arg0, arg1); - } - - public void InfoFormat(string format, object arg0, object arg1, object arg2) { - this.log4netLogger.InfoFormat(format, arg0, arg1, arg2); - } - - public void InfoFormat(IFormatProvider provider, string format, params object[] args) { - this.log4netLogger.InfoFormat(provider, format, args); - } - - public void Warn(object message) { - this.log4netLogger.Warn(message); - } - - public void Warn(object message, Exception exception) { - this.log4netLogger.Warn(message, exception); - } - - public void WarnFormat(string format, params object[] args) { - this.log4netLogger.WarnFormat(CultureInfo.InvariantCulture, format, args); - } - - public void WarnFormat(string format, object arg0) { - this.log4netLogger.WarnFormat(format, arg0); - } - - public void WarnFormat(string format, object arg0, object arg1) { - this.log4netLogger.WarnFormat(format, arg0, arg1); - } - - public void WarnFormat(string format, object arg0, object arg1, object arg2) { - this.log4netLogger.WarnFormat(format, arg0, arg1, arg2); - } - - public void WarnFormat(IFormatProvider provider, string format, params object[] args) { - this.log4netLogger.WarnFormat(provider, format, args); - } - - public void Error(object message) { - this.log4netLogger.Error(message); - } - - public void Error(object message, Exception exception) { - this.log4netLogger.Error(message, exception); - } - - public void ErrorFormat(string format, params object[] args) { - this.log4netLogger.ErrorFormat(CultureInfo.InvariantCulture, format, args); - } - - public void ErrorFormat(string format, object arg0) { - this.log4netLogger.ErrorFormat(format, arg0); - } - - public void ErrorFormat(string format, object arg0, object arg1) { - this.log4netLogger.ErrorFormat(format, arg0, arg1); - } - - public void ErrorFormat(string format, object arg0, object arg1, object arg2) { - this.log4netLogger.ErrorFormat(format, arg0, arg1, arg2); - } - - public void ErrorFormat(IFormatProvider provider, string format, params object[] args) { - this.log4netLogger.ErrorFormat(provider, format, args); - } - - public void Fatal(object message) { - this.log4netLogger.Fatal(message); - } - - public void Fatal(object message, Exception exception) { - this.log4netLogger.Fatal(message, exception); - } - - public void FatalFormat(string format, params object[] args) { - this.log4netLogger.FatalFormat(CultureInfo.InvariantCulture, format, args); - } - - public void FatalFormat(string format, object arg0) { - this.log4netLogger.FatalFormat(format, arg0); - } - - public void FatalFormat(string format, object arg0, object arg1) { - this.log4netLogger.FatalFormat(format, arg0, arg1); - } - - public void FatalFormat(string format, object arg0, object arg1, object arg2) { - this.log4netLogger.FatalFormat(format, arg0, arg1, arg2); - } - - public void FatalFormat(IFormatProvider provider, string format, params object[] args) { - this.log4netLogger.FatalFormat(provider, format, args); - } - - #endregion - - /// <summary> - /// Returns a new log4net logger if it exists, or returns null if the assembly cannot be found. - /// </summary> - /// <returns>The created <see cref="ILog"/> instance.</returns> - internal static ILog Initialize(string name) { - try { - return IsLog4NetPresent ? CreateLogger(name) : null; - } catch (FileLoadException) { // wrong log4net.dll version - return null; - } catch (TargetInvocationException) { // Thrown due to some security issues on .NET 4.5. - return null; - } catch (TypeLoadException) { // Thrown by mono (http://stackoverflow.com/questions/10805773/error-when-pushing-dotnetopenauth-to-staging-or-production-environment) - return null; - } - } - - /// <summary> - /// Creates the log4net.LogManager. Call ONLY after log4net.dll is known to be present. - /// </summary> - /// <returns>The created <see cref="ILog"/> instance.</returns> - private static ILog CreateLogger(string name) { - return new Log4NetLogger(log4net.LogManager.GetLogger(name)); - } - } -} diff --git a/src/DotNetOpenAuth.Core/Loggers/NLogLogger.cs b/src/DotNetOpenAuth.Core/Loggers/NLogLogger.cs deleted file mode 100644 index b5d883d..0000000 --- a/src/DotNetOpenAuth.Core/Loggers/NLogLogger.cs +++ /dev/null @@ -1,222 +0,0 @@ -// <auto-generated /> - -namespace DotNetOpenAuth.Loggers { - using System; - using System.Globalization; - using System.IO; - using System.Reflection; - - internal class NLogLogger : ILog { - private NLog.Logger nLogLogger; - - private NLogLogger(NLog.Logger logger) { - this.nLogLogger = logger; - } - - #region ILog Members - - public bool IsDebugEnabled { - get { return this.nLogLogger.IsDebugEnabled; } - } - - public bool IsInfoEnabled { - get { return this.nLogLogger.IsInfoEnabled; } - } - - public bool IsWarnEnabled { - get { return this.nLogLogger.IsWarnEnabled; } - } - - public bool IsErrorEnabled { - get { return this.nLogLogger.IsErrorEnabled; } - } - - public bool IsFatalEnabled { - get { return this.nLogLogger.IsFatalEnabled; } - } - - #endregion - - private static bool IsNLogPresent { - get { - try { - Assembly.Load("NLog"); - return true; - } catch (FileNotFoundException) { - return false; - } - } - } - - #region ILog methods - - public void Debug(object message) { - this.nLogLogger.Debug(message); - } - - public void Debug(object message, Exception exception) { - this.nLogLogger.DebugException(String.Format("{0}", message), exception); - } - - public void DebugFormat(string format, params object[] args) { - this.nLogLogger.Debug(CultureInfo.InvariantCulture, format, args); - } - - public void DebugFormat(string format, object arg0) { - this.nLogLogger.Debug(format, arg0); - } - - public void DebugFormat(string format, object arg0, object arg1) { - this.nLogLogger.Debug(format, arg0, arg1); - } - - public void DebugFormat(string format, object arg0, object arg1, object arg2) { - this.nLogLogger.Debug(format, arg0, arg1, arg2); - } - - public void DebugFormat(IFormatProvider provider, string format, params object[] args) { - this.nLogLogger.Debug(provider, format, args); - } - - public void Info(object message) { - this.nLogLogger.Info(message); - } - - public void Info(object message, Exception exception) { - this.nLogLogger.InfoException(String.Format("{0}", message), exception); - } - - public void InfoFormat(string format, params object[] args) { - this.nLogLogger.Info(CultureInfo.InvariantCulture, format, args); - } - - public void InfoFormat(string format, object arg0) { - this.nLogLogger.Info(format, arg0); - } - - public void InfoFormat(string format, object arg0, object arg1) { - this.nLogLogger.Info(format, arg0, arg1); - } - - public void InfoFormat(string format, object arg0, object arg1, object arg2) { - this.nLogLogger.Info(format, arg0, arg1, arg2); - } - - public void InfoFormat(IFormatProvider provider, string format, params object[] args) { - this.nLogLogger.Info(provider, format, args); - } - - public void Warn(object message) { - this.nLogLogger.Warn(message); - } - - public void Warn(object message, Exception exception) { - this.nLogLogger.Warn(String.Format("{0}", message), exception); - } - - public void WarnFormat(string format, params object[] args) { - this.nLogLogger.Warn(CultureInfo.InvariantCulture, format, args); - } - - public void WarnFormat(string format, object arg0) { - this.nLogLogger.Warn(format, arg0); - } - - public void WarnFormat(string format, object arg0, object arg1) { - this.nLogLogger.Warn(format, arg0, arg1); - } - - public void WarnFormat(string format, object arg0, object arg1, object arg2) { - this.nLogLogger.Warn(format, arg0, arg1, arg2); - } - - public void WarnFormat(IFormatProvider provider, string format, params object[] args) { - this.nLogLogger.Warn(provider, format, args); - } - - public void Error(object message) { - this.nLogLogger.Error(message); - } - - public void Error(object message, Exception exception) { - this.nLogLogger.Error(String.Format("{0}", message), exception); - } - - public void ErrorFormat(string format, params object[] args) { - this.nLogLogger.Error(CultureInfo.InvariantCulture, format, args); - } - - public void ErrorFormat(string format, object arg0) { - this.nLogLogger.Error(format, arg0); - } - - public void ErrorFormat(string format, object arg0, object arg1) { - this.nLogLogger.Error(format, arg0, arg1); - } - - public void ErrorFormat(string format, object arg0, object arg1, object arg2) { - this.nLogLogger.Error(format, arg0, arg1, arg2); - } - - public void ErrorFormat(IFormatProvider provider, string format, params object[] args) { - this.nLogLogger.Error(provider, format, args); - } - - public void Fatal(object message) { - this.nLogLogger.Fatal(message); - } - - public void Fatal(object message, Exception exception) { - this.nLogLogger.Fatal(String.Format("{0}", message), exception); - } - - public void FatalFormat(string format, params object[] args) { - this.nLogLogger.Fatal(CultureInfo.InvariantCulture, format, args); - } - - public void FatalFormat(string format, object arg0) { - this.nLogLogger.Fatal(format, arg0); - } - - public void FatalFormat(string format, object arg0, object arg1) { - this.nLogLogger.Fatal(format, arg0, arg1); - } - - public void FatalFormat(string format, object arg0, object arg1, object arg2) { - this.nLogLogger.Fatal(format, arg0, arg1, arg2); - } - - public void FatalFormat(IFormatProvider provider, string format, params object[] args) { - this.nLogLogger.Fatal(provider, format, args); - } - - #endregion - - /// <summary> - /// Returns a new NLog logger if it exists, or returns null if the assembly cannot be found. - /// </summary> - /// <returns>The created <see cref="ILog"/> instance.</returns> - internal static ILog Initialize(string name) { - try { - return IsNLogPresent ? CreateLogger(name) : null; - } catch (FileLoadException) { - // wrong NLog.dll version - return null; - } catch (TargetInvocationException) { - // Thrown due to some security issues on .NET 4.5. - return null; - } catch (TypeLoadException) { - // Thrown by mono (http://stackoverflow.com/questions/10805773/error-when-pushing-dotnetopenauth-to-staging-or-production-environment) - return null; - } - } - - /// <summary> - /// Creates the NLogLogger. Call ONLY after NLog.dll is known to be present. - /// </summary> - /// <returns>The created <see cref="ILog"/> instance.</returns> - private static ILog CreateLogger(string name) { - return new NLogLogger(NLog.LogManager.GetLogger(name)); - } - } -} diff --git a/src/DotNetOpenAuth.Core/Loggers/NoOpLogger.cs b/src/DotNetOpenAuth.Core/Loggers/NoOpLogger.cs deleted file mode 100644 index 7d1b37f..0000000 --- a/src/DotNetOpenAuth.Core/Loggers/NoOpLogger.cs +++ /dev/null @@ -1,159 +0,0 @@ -// <auto-generated /> - -namespace DotNetOpenAuth.Loggers { - using System; - - internal class NoOpLogger : ILog { - #region ILog Members - - public bool IsDebugEnabled { - get { return false; } - } - - public bool IsInfoEnabled { - get { return false; } - } - - public bool IsWarnEnabled { - get { return false; } - } - - public bool IsErrorEnabled { - get { return false; } - } - - public bool IsFatalEnabled { - get { return false; } - } - - public void Debug(object message) { - return; - } - - public void Debug(object message, Exception exception) { - return; - } - - public void DebugFormat(string format, params object[] args) { - return; - } - - public void DebugFormat(string format, object arg0) { - return; - } - - public void DebugFormat(string format, object arg0, object arg1) { - return; - } - - public void DebugFormat(string format, object arg0, object arg1, object arg2) { - return; - } - - public void Info(object message) { - return; - } - - public void Info(object message, Exception exception) { - return; - } - - public void InfoFormat(string format, params object[] args) { - return; - } - - public void InfoFormat(string format, object arg0) { - return; - } - - public void InfoFormat(string format, object arg0, object arg1) { - return; - } - - public void InfoFormat(string format, object arg0, object arg1, object arg2) { - return; - } - - public void Warn(object message) { - return; - } - - public void Warn(object message, Exception exception) { - return; - } - - public void WarnFormat(string format, params object[] args) { - return; - } - - public void WarnFormat(string format, object arg0) { - return; - } - - public void WarnFormat(string format, object arg0, object arg1) { - return; - } - - public void WarnFormat(string format, object arg0, object arg1, object arg2) { - return; - } - - public void Error(object message) { - return; - } - - public void Error(object message, Exception exception) { - return; - } - - public void ErrorFormat(string format, params object[] args) { - return; - } - - public void ErrorFormat(string format, object arg0) { - return; - } - - public void ErrorFormat(string format, object arg0, object arg1) { - return; - } - - public void ErrorFormat(string format, object arg0, object arg1, object arg2) { - return; - } - - public void Fatal(object message) { - return; - } - - public void Fatal(object message, Exception exception) { - return; - } - - public void FatalFormat(string format, params object[] args) { - return; - } - - public void FatalFormat(string format, object arg0) { - return; - } - - public void FatalFormat(string format, object arg0, object arg1) { - return; - } - - public void FatalFormat(string format, object arg0, object arg1, object arg2) { - return; - } - - #endregion - - /// <summary> - /// Returns a new logger that does nothing when invoked. - /// </summary> - /// <returns>The created <see cref="ILog"/> instance.</returns> - internal static ILog Initialize() { - return new NoOpLogger(); - } - } -} diff --git a/src/DotNetOpenAuth.Core/Loggers/TraceLogger.cs b/src/DotNetOpenAuth.Core/Loggers/TraceLogger.cs deleted file mode 100644 index 1b80c7d..0000000 --- a/src/DotNetOpenAuth.Core/Loggers/TraceLogger.cs +++ /dev/null @@ -1,357 +0,0 @@ -// <auto-generated /> - -namespace DotNetOpenAuth.Loggers { - using System; - using System.Diagnostics; - using System.Security; - using System.Security.Permissions; - - internal class TraceLogger : ILog { - private TraceSwitch traceSwitch; - - internal TraceLogger(string name) { - traceSwitch = new TraceSwitch(name, name + " Trace Switch"); - } - - #region ILog Properties - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public bool IsDebugEnabled { - get { return this.traceSwitch.TraceVerbose; } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public bool IsInfoEnabled { - get { return this.traceSwitch.TraceInfo; } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public bool IsWarnEnabled { - get { return this.traceSwitch.TraceWarning; } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public bool IsErrorEnabled { - get { return this.traceSwitch.TraceError; } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public bool IsFatalEnabled { - get { return this.traceSwitch.TraceError; } - } - - #endregion - - private static bool IsSufficientPermissionGranted { - get { - PermissionSet permissions = new PermissionSet(PermissionState.None); - permissions.AddPermission(new KeyContainerPermission(PermissionState.Unrestricted)); - permissions.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess)); - permissions.AddPermission(new RegistryPermission(PermissionState.Unrestricted)); - permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.UnmanagedCode | SecurityPermissionFlag.ControlThread)); - var file = new FileIOPermission(PermissionState.None); - file.AllFiles = FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read; - permissions.AddPermission(file); - try { - permissions.Demand(); - return true; - } catch (SecurityException) { - return false; - } - } - } - - #region ILog Methods - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Debug(object message) { - if (this.IsDebugEnabled) { - Trace.TraceInformation(message.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Debug(object message, Exception exception) { - if (this.IsDebugEnabled) { - Trace.TraceInformation(message + ": " + exception.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void DebugFormat(string format, params object[] args) { - if (this.IsDebugEnabled) { - Trace.TraceInformation(format, args); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void DebugFormat(string format, object arg0) { - if (this.IsDebugEnabled) { - Trace.TraceInformation(format, arg0); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void DebugFormat(string format, object arg0, object arg1) { - if (this.IsDebugEnabled) { - Trace.TraceInformation(format, arg0, arg1); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void DebugFormat(string format, object arg0, object arg1, object arg2) { - if (this.IsDebugEnabled) { - Trace.TraceInformation(format, arg0, arg1, arg2); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Info(object message) { - if (this.IsInfoEnabled) { - Trace.TraceInformation(message.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Info(object message, Exception exception) { - if (this.IsInfoEnabled) { - Trace.TraceInformation(message + ": " + exception.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void InfoFormat(string format, params object[] args) { - if (this.IsInfoEnabled) { - Trace.TraceInformation(format, args); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void InfoFormat(string format, object arg0) { - if (this.IsInfoEnabled) { - Trace.TraceInformation(format, arg0); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void InfoFormat(string format, object arg0, object arg1) { - if (this.IsInfoEnabled) { - Trace.TraceInformation(format, arg0, arg1); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void InfoFormat(string format, object arg0, object arg1, object arg2) { - if (this.IsInfoEnabled) { - Trace.TraceInformation(format, arg0, arg1, arg2); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Warn(object message) { - if (this.IsWarnEnabled) { - Trace.TraceWarning(message.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Warn(object message, Exception exception) { - if (this.IsWarnEnabled) { - Trace.TraceWarning(message + ": " + exception.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void WarnFormat(string format, params object[] args) { - if (this.IsWarnEnabled) { - Trace.TraceWarning(format, args); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void WarnFormat(string format, object arg0) { - if (this.IsWarnEnabled) { - Trace.TraceWarning(format, arg0); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void WarnFormat(string format, object arg0, object arg1) { - if (this.IsWarnEnabled) { - Trace.TraceWarning(format, arg0, arg1); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void WarnFormat(string format, object arg0, object arg1, object arg2) { - if (this.IsWarnEnabled) { - Trace.TraceWarning(format, arg0, arg1, arg2); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Error(object message) { - if (this.IsErrorEnabled) { - Trace.TraceError(message.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Error(object message, Exception exception) { - if (this.IsErrorEnabled) { - Trace.TraceError(message + ": " + exception.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void ErrorFormat(string format, params object[] args) { - if (this.IsErrorEnabled) { - Trace.TraceError(format, args); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void ErrorFormat(string format, object arg0) { - if (this.IsErrorEnabled) { - Trace.TraceError(format, arg0); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void ErrorFormat(string format, object arg0, object arg1) { - if (this.IsErrorEnabled) { - Trace.TraceError(format, arg0, arg1); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void ErrorFormat(string format, object arg0, object arg1, object arg2) { - if (this.IsErrorEnabled) { - Trace.TraceError(format, arg0, arg1, arg2); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Fatal(object message) { - if (this.IsFatalEnabled) { - Trace.TraceError(message.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void Fatal(object message, Exception exception) { - if (this.IsFatalEnabled) { - Trace.TraceError(message + ": " + exception.ToString()); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void FatalFormat(string format, params object[] args) { - if (this.IsFatalEnabled) { - Trace.TraceError(format, args); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void FatalFormat(string format, object arg0) { - if (this.IsFatalEnabled) { - Trace.TraceError(format, arg0); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void FatalFormat(string format, object arg0, object arg1) { - if (this.IsFatalEnabled) { - Trace.TraceError(format, arg0, arg1); - } - } - - /// <summary> - /// See <see cref="ILog"/>. - /// </summary> - public void FatalFormat(string format, object arg0, object arg1, object arg2) { - if (this.IsFatalEnabled) { - Trace.TraceError(format, arg0, arg1, arg2); - } - } - - #endregion - - /// <summary> - /// Returns a new logger that uses the <see cref="System.Diagnostics.Trace"/> class - /// if sufficient CAS permissions are granted to use it, otherwise returns false. - /// </summary> - /// <returns>The created <see cref="ILog"/> instance.</returns> - internal static ILog Initialize(string name) { - return IsSufficientPermissionGranted ? new TraceLogger(name) : null; - } - } -} |