summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-08-31 20:43:56 -0700
committerAndrew <andrewarnott@gmail.com>2008-08-31 20:43:56 -0700
commit22f2e18dfaeff7ab1be6f6f26f7321eaac94e749 (patch)
treea853ba924f7c2d47bee05b3533b9352a36205a00
parentba57c42a89f8267db4b2dd8673f23ce826e0b151 (diff)
downloadDotNetOpenAuth-22f2e18dfaeff7ab1be6f6f26f7321eaac94e749.zip
DotNetOpenAuth-22f2e18dfaeff7ab1be6f6f26f7321eaac94e749.tar.gz
DotNetOpenAuth-22f2e18dfaeff7ab1be6f6f26f7321eaac94e749.tar.bz2
Added more StyleCop rules.
-rw-r--r--src/Settings.StyleCop45
-rw-r--r--src/YOURLIBNAME.Test/Properties/AssemblyInfo.cs7
-rw-r--r--src/YOURLIBNAME.Test/Settings.StyleCop1
-rw-r--r--src/YOURLIBNAME.Test/TestBase.cs19
-rw-r--r--src/YOURLIBNAME/Logger.cs733
-rw-r--r--src/YOURLIBNAME/Loggers/Log4NetLogger.cs116
-rw-r--r--src/YOURLIBNAME/Loggers/NoOpLogger.cs6
-rw-r--r--src/YOURLIBNAME/Loggers/TraceLogger.cs176
-rw-r--r--src/YOURLIBNAME/Settings.StyleCop15
-rw-r--r--src/YOURLIBNAME/Util.cs16
10 files changed, 999 insertions, 135 deletions
diff --git a/src/Settings.StyleCop b/src/Settings.StyleCop
index c5b920c..8831d6b 100644
--- a/src/Settings.StyleCop
+++ b/src/Settings.StyleCop
@@ -20,50 +20,5 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.OrderingRules">
- <Rules>
- <Rule Name="ElementsMustBeOrderedByAccess">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">
- <Rules>
- <Rule Name="ElementsMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileMustHaveHeader">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.MaintainabilityRules">
- <Rules>
- <Rule Name="AccessModifierMustBeDeclared">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.ReadabilityRules">
- <Rules>
- <Rule Name="PrefixLocalCallsWithThis">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
</Analyzers>
</StyleCopSettings> \ No newline at end of file
diff --git a/src/YOURLIBNAME.Test/Properties/AssemblyInfo.cs b/src/YOURLIBNAME.Test/Properties/AssemblyInfo.cs
index d065d7a..c37288a 100644
--- a/src/YOURLIBNAME.Test/Properties/AssemblyInfo.cs
+++ b/src/YOURLIBNAME.Test/Properties/AssemblyInfo.cs
@@ -1,4 +1,9 @@
-using System.Reflection;
+//-----------------------------------------------------------------------
+// <copyright file="AssemblyInfo.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
diff --git a/src/YOURLIBNAME.Test/Settings.StyleCop b/src/YOURLIBNAME.Test/Settings.StyleCop
new file mode 100644
index 0000000..7f55ce6
--- /dev/null
+++ b/src/YOURLIBNAME.Test/Settings.StyleCop
@@ -0,0 +1 @@
+<StyleCopSettings Version="4.3" /> \ No newline at end of file
diff --git a/src/YOURLIBNAME.Test/TestBase.cs b/src/YOURLIBNAME.Test/TestBase.cs
index 94b2f4f..5a9c94f 100644
--- a/src/YOURLIBNAME.Test/TestBase.cs
+++ b/src/YOURLIBNAME.Test/TestBase.cs
@@ -1,9 +1,20 @@
-namespace YOURLIBNAME.Test {
+//-----------------------------------------------------------------------
+// <copyright file="TestBase.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+namespace YOURLIBNAME.Test {
using System.Reflection;
using log4net;
using Microsoft.VisualStudio.TestTools.UnitTesting;
+ /// <summary>
+ /// The base class that all test classes inherit from.
+ /// </summary>
public class TestBase {
+ /// <summary>
+ /// The logger that tests should use.
+ /// </summary>
internal static readonly ILog Logger = LogManager.GetLogger("YOURLIBNAME.Test");
/// <summary>
@@ -12,11 +23,17 @@
/// </summary>
public TestContext TestContext { get; set; }
+ /// <summary>
+ /// The TestInitialize method for the test cases.
+ /// </summary>
[TestInitialize]
public virtual void SetUp() {
log4net.Config.XmlConfigurator.Configure(Assembly.GetExecutingAssembly().GetManifestResourceStream("YOURLIBNAME.Test.Logging.config"));
}
+ /// <summary>
+ /// The TestCleanup method for the test cases.
+ /// </summary>
[TestCleanup]
public virtual void Cleanup() {
log4net.LogManager.Shutdown();
diff --git a/src/YOURLIBNAME/Logger.cs b/src/YOURLIBNAME/Logger.cs
index f316495..2d89e8d 100644
--- a/src/YOURLIBNAME/Logger.cs
+++ b/src/YOURLIBNAME/Logger.cs
@@ -1,6 +1,13 @@
+//-----------------------------------------------------------------------
+// <copyright file="Logger.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
namespace YOURLIBNAME {
using System;
using System.Globalization;
+ using log4net.Core;
using YOURLIBNAME.Loggers;
/// <summary>
@@ -11,53 +18,292 @@ namespace YOURLIBNAME {
/// overloads that take <see cref="CultureInfo"/> have been removed, and
/// <see cref="CultureInfo.InvariantCulture"/> is used implicitly.
/// </remarks>
- static class Logger {
- static ILog facade = InitializeFacade();
+ internal static class Logger {
+ /// <summary>
+ /// The <see cref="ILog"/> instance that is to be used for the duration of the appdomain.
+ /// </summary>
+ private static ILog facade = InitializeFacade();
#region ILog Members
//// Although this static class doesn't literally implement the ILog interface,
//// we implement (mostly) all the same methods in a static way.
+ /// <summary>
+ /// Gets a value indicating whether 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)"/>
+ /// <seealso cref="DebugFormat(string, object[])"/>
public static bool IsDebugEnabled {
get { return facade.IsDebugEnabled; }
}
+ /// <summary>
+ /// Gets a value indicating whether 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="InfoFormat(string, object[])"/>
+ /// <seealso cref="ILog.IsDebugEnabled"/>
public static bool IsInfoEnabled {
get { return facade.IsInfoEnabled; }
}
+ /// <summary>
+ /// Gets a value indicating whether 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="WarnFormat(string, object[])"/>
+ /// <seealso cref="ILog.IsDebugEnabled"/>
public static bool IsWarnEnabled {
get { return facade.IsWarnEnabled; }
}
+ /// <summary>
+ /// Gets a value indicating whether 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="ErrorFormat(string, object[])"/>
+ /// <seealso cref="ILog.IsDebugEnabled"/>
public static bool IsErrorEnabled {
get { return facade.IsErrorEnabled; }
}
+ /// <summary>
+ /// Gets a value indicating whether 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="FatalFormat(string, object[])"/>
+ /// <seealso cref="ILog.IsDebugEnabled"/>
public static bool IsFatalEnabled {
get { return facade.IsFatalEnabled; }
}
+ /// <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"/>
public static void Debug(object message) {
facade.Debug(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"/>
public static void Debug(object message, Exception exception) {
facade.Debug(message, 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"/>
public static void DebugFormat(string format, params object[] args) {
facade.DebugFormat(CultureInfo.InvariantCulture, format, 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"/>
public static void DebugFormat(string format, object arg0) {
facade.DebugFormat(format, 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"/>
public static void DebugFormat(string format, object arg0, object arg1) {
facade.DebugFormat(format, arg0, 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"/>
public static void DebugFormat(string format, object arg0, object arg1, object arg2) {
facade.DebugFormat(format, arg0, arg1, arg2);
}
@@ -68,26 +314,145 @@ namespace YOURLIBNAME {
}
*/
+ /// <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"/>
public static void Info(object message) {
facade.Info(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"/>
public static void Info(object message, Exception exception) {
facade.Info(message, 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"/>
public static void InfoFormat(string format, params object[] args) {
facade.InfoFormat(CultureInfo.InvariantCulture, format, 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"/>
public static void InfoFormat(string format, object arg0) {
facade.InfoFormat(format, 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"/>
public static void InfoFormat(string format, object arg0, object arg1) {
facade.InfoFormat(format, arg0, 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"/>
public static void InfoFormat(string format, object arg0, object arg1, object arg2) {
facade.InfoFormat(format, arg0, arg1, arg2);
}
@@ -98,26 +463,145 @@ namespace YOURLIBNAME {
}
*/
+ /// <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"/>
public static void Warn(object message) {
facade.Warn(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"/>
public static void Warn(object message, Exception exception) {
facade.Warn(message, 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"/>
public static void WarnFormat(string format, params object[] args) {
facade.WarnFormat(CultureInfo.InvariantCulture, format, 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"/>
public static void WarnFormat(string format, object arg0) {
facade.WarnFormat(format, 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"/>
public static void WarnFormat(string format, object arg0, object arg1) {
facade.WarnFormat(format, arg0, 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"/>
public static void WarnFormat(string format, object arg0, object arg1, object arg2) {
facade.WarnFormat(format, arg0, arg1, arg2);
}
@@ -128,26 +612,145 @@ namespace YOURLIBNAME {
}
*/
+ /// <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"/>
public static void Error(object message) {
facade.Error(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"/>
public static void Error(object message, Exception exception) {
facade.Error(message, 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"/>
public static void ErrorFormat(string format, params object[] args) {
facade.ErrorFormat(CultureInfo.InvariantCulture, format, 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"/>
public static void ErrorFormat(string format, object arg0) {
facade.ErrorFormat(format, 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"/>
public static void ErrorFormat(string format, object arg0, object arg1) {
facade.ErrorFormat(format, arg0, 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"/>
public static void ErrorFormat(string format, object arg0, object arg1, object arg2) {
facade.ErrorFormat(format, arg0, arg1, arg2);
}
@@ -158,26 +761,145 @@ namespace YOURLIBNAME {
}
*/
+ /// <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"/>
public static void Fatal(object message) {
facade.Fatal(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"/>
public static void Fatal(object message, Exception exception) {
facade.Fatal(message, 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"/>
public static void FatalFormat(string format, params object[] args) {
facade.FatalFormat(CultureInfo.InvariantCulture, format, 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"/>
public static void FatalFormat(string format, object arg0) {
facade.FatalFormat(format, 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"/>
public static void FatalFormat(string format, object arg0, object arg1) {
facade.FatalFormat(format, arg0, 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"/>
public static void FatalFormat(string format, object arg0, object arg1, object arg2) {
facade.FatalFormat(format, arg0, arg1, arg2);
}
@@ -190,7 +912,12 @@ namespace YOURLIBNAME {
#endregion
- static ILog InitializeFacade() {
+ /// <summary>
+ /// Discovers the presence of Log4net.dll and other logging mechanisms
+ /// and returns the best available logger.
+ /// </summary>
+ /// <returns>The <see cref="ILog"/> instance of the logger to use.</returns>
+ private static ILog InitializeFacade() {
ILog result = Log4NetLogger.Initialize() ?? TraceLogger.Initialize() ?? NoOpLogger.Initialize();
result.Info(Util.LibraryVersion);
return result;
diff --git a/src/YOURLIBNAME/Loggers/Log4NetLogger.cs b/src/YOURLIBNAME/Loggers/Log4NetLogger.cs
index 2823ca5..eed0783 100644
--- a/src/YOURLIBNAME/Loggers/Log4NetLogger.cs
+++ b/src/YOURLIBNAME/Loggers/Log4NetLogger.cs
@@ -1,187 +1,193 @@
-namespace YOURLIBNAME.Loggers {
+// <auto-generated />
+
+namespace YOURLIBNAME.Loggers {
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
- class Log4NetLogger : ILog {
+ internal class Log4NetLogger : ILog {
private log4net.ILog log4netLogger;
private Log4NetLogger(log4net.ILog logger) {
- log4netLogger = logger;
- }
-
- static bool IsLog4NetPresent {
- get {
- try {
- Assembly.Load("log4net");
- return true;
- } catch (FileNotFoundException) {
- return false;
- }
- }
+ this.log4netLogger = logger;
}
#region ILog Members
public bool IsDebugEnabled {
- get { return log4netLogger.IsDebugEnabled; }
+ get { return this.log4netLogger.IsDebugEnabled; }
}
public bool IsInfoEnabled {
- get { return log4netLogger.IsInfoEnabled; }
+ get { return this.log4netLogger.IsInfoEnabled; }
}
public bool IsWarnEnabled {
- get { return log4netLogger.IsWarnEnabled; }
+ get { return this.log4netLogger.IsWarnEnabled; }
}
public bool IsErrorEnabled {
- get { return log4netLogger.IsErrorEnabled; }
+ get { return this.log4netLogger.IsErrorEnabled; }
}
public bool IsFatalEnabled {
- get { return log4netLogger.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) {
- log4netLogger.Debug(message);
+ this.log4netLogger.Debug(message);
}
public void Debug(object message, Exception exception) {
- log4netLogger.Debug(message, exception);
+ this.log4netLogger.Debug(message, exception);
}
public void DebugFormat(string format, params object[] args) {
- log4netLogger.DebugFormat(CultureInfo.InvariantCulture, format, args);
+ this.log4netLogger.DebugFormat(CultureInfo.InvariantCulture, format, args);
}
public void DebugFormat(string format, object arg0) {
- log4netLogger.DebugFormat(format, arg0);
+ this.log4netLogger.DebugFormat(format, arg0);
}
public void DebugFormat(string format, object arg0, object arg1) {
- log4netLogger.DebugFormat(format, arg0, arg1);
+ this.log4netLogger.DebugFormat(format, arg0, arg1);
}
public void DebugFormat(string format, object arg0, object arg1, object arg2) {
- log4netLogger.DebugFormat(format, arg0, arg1, arg2);
+ this.log4netLogger.DebugFormat(format, arg0, arg1, arg2);
}
public void DebugFormat(IFormatProvider provider, string format, params object[] args) {
- log4netLogger.DebugFormat(provider, format, args);
+ this.log4netLogger.DebugFormat(provider, format, args);
}
public void Info(object message) {
- log4netLogger.Info(message);
+ this.log4netLogger.Info(message);
}
public void Info(object message, Exception exception) {
- log4netLogger.Info(message, exception);
+ this.log4netLogger.Info(message, exception);
}
public void InfoFormat(string format, params object[] args) {
- log4netLogger.InfoFormat(CultureInfo.InvariantCulture, format, args);
+ this.log4netLogger.InfoFormat(CultureInfo.InvariantCulture, format, args);
}
public void InfoFormat(string format, object arg0) {
- log4netLogger.InfoFormat(format, arg0);
+ this.log4netLogger.InfoFormat(format, arg0);
}
public void InfoFormat(string format, object arg0, object arg1) {
- log4netLogger.InfoFormat(format, arg0, arg1);
+ this.log4netLogger.InfoFormat(format, arg0, arg1);
}
public void InfoFormat(string format, object arg0, object arg1, object arg2) {
- log4netLogger.InfoFormat(format, arg0, arg1, arg2);
+ this.log4netLogger.InfoFormat(format, arg0, arg1, arg2);
}
public void InfoFormat(IFormatProvider provider, string format, params object[] args) {
- log4netLogger.InfoFormat(provider, format, args);
+ this.log4netLogger.InfoFormat(provider, format, args);
}
public void Warn(object message) {
- log4netLogger.Warn(message);
+ this.log4netLogger.Warn(message);
}
public void Warn(object message, Exception exception) {
- log4netLogger.Warn(message, exception);
+ this.log4netLogger.Warn(message, exception);
}
public void WarnFormat(string format, params object[] args) {
- log4netLogger.WarnFormat(CultureInfo.InvariantCulture, format, args);
+ this.log4netLogger.WarnFormat(CultureInfo.InvariantCulture, format, args);
}
public void WarnFormat(string format, object arg0) {
- log4netLogger.WarnFormat(format, arg0);
+ this.log4netLogger.WarnFormat(format, arg0);
}
public void WarnFormat(string format, object arg0, object arg1) {
- log4netLogger.WarnFormat(format, arg0, arg1);
+ this.log4netLogger.WarnFormat(format, arg0, arg1);
}
public void WarnFormat(string format, object arg0, object arg1, object arg2) {
- log4netLogger.WarnFormat(format, arg0, arg1, arg2);
+ this.log4netLogger.WarnFormat(format, arg0, arg1, arg2);
}
public void WarnFormat(IFormatProvider provider, string format, params object[] args) {
- log4netLogger.WarnFormat(provider, format, args);
+ this.log4netLogger.WarnFormat(provider, format, args);
}
public void Error(object message) {
- log4netLogger.Error(message);
+ this.log4netLogger.Error(message);
}
public void Error(object message, Exception exception) {
- log4netLogger.Error(message, exception);
+ this.log4netLogger.Error(message, exception);
}
public void ErrorFormat(string format, params object[] args) {
- log4netLogger.ErrorFormat(CultureInfo.InvariantCulture, format, args);
+ this.log4netLogger.ErrorFormat(CultureInfo.InvariantCulture, format, args);
}
public void ErrorFormat(string format, object arg0) {
- log4netLogger.ErrorFormat(format, arg0);
+ this.log4netLogger.ErrorFormat(format, arg0);
}
public void ErrorFormat(string format, object arg0, object arg1) {
- log4netLogger.ErrorFormat(format, arg0, arg1);
+ this.log4netLogger.ErrorFormat(format, arg0, arg1);
}
public void ErrorFormat(string format, object arg0, object arg1, object arg2) {
- log4netLogger.ErrorFormat(format, arg0, arg1, arg2);
+ this.log4netLogger.ErrorFormat(format, arg0, arg1, arg2);
}
public void ErrorFormat(IFormatProvider provider, string format, params object[] args) {
- log4netLogger.ErrorFormat(provider, format, args);
+ this.log4netLogger.ErrorFormat(provider, format, args);
}
public void Fatal(object message) {
- log4netLogger.Fatal(message);
+ this.log4netLogger.Fatal(message);
}
public void Fatal(object message, Exception exception) {
- log4netLogger.Fatal(message, exception);
+ this.log4netLogger.Fatal(message, exception);
}
public void FatalFormat(string format, params object[] args) {
- log4netLogger.FatalFormat(CultureInfo.InvariantCulture, format, args);
+ this.log4netLogger.FatalFormat(CultureInfo.InvariantCulture, format, args);
}
public void FatalFormat(string format, object arg0) {
- log4netLogger.FatalFormat(format, arg0);
+ this.log4netLogger.FatalFormat(format, arg0);
}
public void FatalFormat(string format, object arg0, object arg1) {
- log4netLogger.FatalFormat(format, arg0, arg1);
+ this.log4netLogger.FatalFormat(format, arg0, arg1);
}
public void FatalFormat(string format, object arg0, object arg1, object arg2) {
- log4netLogger.FatalFormat(format, arg0, arg1, arg2);
+ this.log4netLogger.FatalFormat(format, arg0, arg1, arg2);
}
public void FatalFormat(IFormatProvider provider, string format, params object[] args) {
- log4netLogger.FatalFormat(provider, format, args);
+ this.log4netLogger.FatalFormat(provider, format, args);
}
#endregion
@@ -198,7 +204,7 @@
/// Creates the log4net.LogManager. Call ONLY after log4net.dll is known to be present.
/// </summary>
/// <returns>The created <see cref="ILog"/> instance.</returns>
- static ILog CreateLogger() {
+ private static ILog CreateLogger() {
return new Log4NetLogger(log4net.LogManager.GetLogger("YOURLIBNAME"));
}
}
diff --git a/src/YOURLIBNAME/Loggers/NoOpLogger.cs b/src/YOURLIBNAME/Loggers/NoOpLogger.cs
index 9adbfa9..768bd70 100644
--- a/src/YOURLIBNAME/Loggers/NoOpLogger.cs
+++ b/src/YOURLIBNAME/Loggers/NoOpLogger.cs
@@ -1,7 +1,9 @@
-namespace YOURLIBNAME.Loggers {
+// <auto-generated />
+
+namespace YOURLIBNAME.Loggers {
using System;
- class NoOpLogger : ILog {
+ internal class NoOpLogger : ILog {
#region ILog Members
public bool IsDebugEnabled {
diff --git a/src/YOURLIBNAME/Loggers/TraceLogger.cs b/src/YOURLIBNAME/Loggers/TraceLogger.cs
index 33447f7..8bebe3b 100644
--- a/src/YOURLIBNAME/Loggers/TraceLogger.cs
+++ b/src/YOURLIBNAME/Loggers/TraceLogger.cs
@@ -1,13 +1,54 @@
-namespace YOURLIBNAME.Loggers {
+// <auto-generated />
+
+namespace YOURLIBNAME.Loggers {
using System;
using System.Diagnostics;
using System.Security;
using System.Security.Permissions;
- class TraceLogger : ILog {
- TraceSwitch traceSwitch = new TraceSwitch("OpenID", "OpenID Trace Switch");
+ internal class TraceLogger : ILog {
+ private TraceSwitch traceSwitch = new TraceSwitch("OpenID", "OpenID 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
- static bool IsSufficientPermissionGranted {
+ private static bool IsSufficientPermissionGranted {
get {
PermissionSet permissions = new PermissionSet(PermissionState.None);
permissions.AddPermission(new KeyContainerPermission(PermissionState.Unrestricted));
@@ -26,164 +67,249 @@
}
}
- #region ILog Members
-
- public bool IsDebugEnabled {
- get { return traceSwitch.TraceVerbose; }
- }
-
- public bool IsInfoEnabled {
- get { return traceSwitch.TraceInfo; }
- }
-
- public bool IsWarnEnabled {
- get { return traceSwitch.TraceWarning; }
- }
-
- public bool IsErrorEnabled {
- get { return traceSwitch.TraceError; }
- }
-
- public bool IsFatalEnabled {
- get { return traceSwitch.TraceError; }
- }
+ #region ILog Methods
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Debug(object message) {
Trace.TraceInformation(message.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Debug(object message, Exception exception) {
Trace.TraceInformation(message + ": " + exception.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void DebugFormat(string format, params object[] args) {
Trace.TraceInformation(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void DebugFormat(string format, object arg0) {
Trace.TraceInformation(format, arg0);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void DebugFormat(string format, object arg0, object arg1) {
Trace.TraceInformation(format, arg0, arg1);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void DebugFormat(string format, object arg0, object arg1, object arg2) {
Trace.TraceInformation(format, arg0, arg1, arg2);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void DebugFormat(IFormatProvider provider, string format, params object[] args) {
Trace.TraceInformation(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Info(object message) {
Trace.TraceInformation(message.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Info(object message, Exception exception) {
Trace.TraceInformation(message + ": " + exception.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void InfoFormat(string format, params object[] args) {
Trace.TraceInformation(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void InfoFormat(string format, object arg0) {
Trace.TraceInformation(format, arg0);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void InfoFormat(string format, object arg0, object arg1) {
Trace.TraceInformation(format, arg0, arg1);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void InfoFormat(string format, object arg0, object arg1, object arg2) {
Trace.TraceInformation(format, arg0, arg1, arg2);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void InfoFormat(IFormatProvider provider, string format, params object[] args) {
Trace.TraceInformation(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Warn(object message) {
Trace.TraceWarning(message.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Warn(object message, Exception exception) {
Trace.TraceWarning(message + ": " + exception.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void WarnFormat(string format, params object[] args) {
Trace.TraceWarning(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void WarnFormat(string format, object arg0) {
Trace.TraceWarning(format, arg0);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void WarnFormat(string format, object arg0, object arg1) {
Trace.TraceWarning(format, arg0, arg1);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void WarnFormat(string format, object arg0, object arg1, object arg2) {
Trace.TraceWarning(format, arg0, arg1, arg2);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void WarnFormat(IFormatProvider provider, string format, params object[] args) {
Trace.TraceWarning(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Error(object message) {
Trace.TraceError(message.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Error(object message, Exception exception) {
Trace.TraceError(message + ": " + exception.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void ErrorFormat(string format, params object[] args) {
Trace.TraceError(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void ErrorFormat(string format, object arg0) {
Trace.TraceError(format, arg0);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void ErrorFormat(string format, object arg0, object arg1) {
Trace.TraceError(format, arg0, arg1);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void ErrorFormat(string format, object arg0, object arg1, object arg2) {
Trace.TraceError(format, arg0, arg1, arg2);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void ErrorFormat(IFormatProvider provider, string format, params object[] args) {
Trace.TraceError(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Fatal(object message) {
Trace.TraceError(message.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void Fatal(object message, Exception exception) {
Trace.TraceError(message + ": " + exception.ToString());
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void FatalFormat(string format, params object[] args) {
Trace.TraceError(format, args);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void FatalFormat(string format, object arg0) {
Trace.TraceError(format, arg0);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void FatalFormat(string format, object arg0, object arg1) {
Trace.TraceError(format, arg0, arg1);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void FatalFormat(string format, object arg0, object arg1, object arg2) {
Trace.TraceError(format, arg0, arg1, arg2);
}
+ /// <summary>
+ /// See <see cref="ILog"/>.
+ /// </summary>
public void FatalFormat(IFormatProvider provider, string format, params object[] args) {
Trace.TraceError(format, args);
}
diff --git a/src/YOURLIBNAME/Settings.StyleCop b/src/YOURLIBNAME/Settings.StyleCop
index 7f55ce6..2eaae96 100644
--- a/src/YOURLIBNAME/Settings.StyleCop
+++ b/src/YOURLIBNAME/Settings.StyleCop
@@ -1 +1,14 @@
-<StyleCopSettings Version="4.3" /> \ No newline at end of file
+<StyleCopSettings Version="4.3">
+ <Analyzers>
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">
+ <Rules>
+ <Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ </Analyzers>
+</StyleCopSettings> \ No newline at end of file
diff --git a/src/YOURLIBNAME/Util.cs b/src/YOURLIBNAME/Util.cs
index fed1c85..16f52fa 100644
--- a/src/YOURLIBNAME/Util.cs
+++ b/src/YOURLIBNAME/Util.cs
@@ -1,8 +1,20 @@
-namespace YOURLIBNAME {
+//-----------------------------------------------------------------------
+// <copyright file="Util.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+namespace YOURLIBNAME {
using System.Globalization;
using System.Reflection;
- class Util {
+ /// <summary>
+ /// A grab-bag utility class.
+ /// </summary>
+ internal class Util {
+ /// <summary>
+ /// Gets a human-readable description of the library name and version, including
+ /// whether the build is an official or private one.
+ /// </summary>
public static string LibraryVersion {
get {
string assemblyFullName = Assembly.GetExecutingAssembly().FullName;