Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Logging
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv1544
Modified Files:
AbstractLoggingAdvice.cs SimpleLoggingAdvice.cs
Log Message:
SPRNET-800 - SimpleLoggingAdvice does not correctly check for logging level other than trace.
Index: SimpleLoggingAdvice.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Logging/SimpleLoggingAdvice.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SimpleLoggingAdvice.cs 11 Oct 2007 01:29:42 -0000 1.4
--- SimpleLoggingAdvice.cs 6 Dec 2007 17:17:19 -0000 1.5
***************
*** 204,207 ****
--- 204,267 ----
}
+
+ /// <summary>
+ /// Determines whether the given log is enabled.
+ /// </summary>
+ /// <param name="log">The log instance to check.</param>
+ /// <returns>
+ /// <c>true</c> if log is for a given log level; otherwise, <c>false</c>.
+ /// </returns>
+ /// <remarks>
+ /// Default is true when the trace level is enabled. Subclasses may override this
+ /// to change the level at which logging occurs, or return true to ignore level
+ /// checks.</remarks>
+ protected override bool IsLogEnabled(ILog log)
+ {
+ switch (LogLevel)
+ {
+ case LogLevel.All:
+ case LogLevel.Trace:
+ if (log.IsTraceEnabled)
+ {
+ return true;
+ }
+ break;
+ case LogLevel.Debug:
+ if (log.IsDebugEnabled)
+ {
+ return true;
+ }
+ break;
+ case LogLevel.Error:
+ if (log.IsErrorEnabled)
+ {
+ return true;
+ }
+ break;
+ case LogLevel.Fatal:
+ if (log.IsFatalEnabled)
+ {
+ return true;
+ }
+ break;
+ case LogLevel.Info:
+ if (log.IsInfoEnabled)
+ {
+ return true;
+ }
+ break;
+ case LogLevel.Warn:
+ if (log.IsWarnEnabled)
+ {
+ return true;
+ }
+ break;
+ case LogLevel.Off:
+ default:
+ break;
+ }
+ return false;
+ }
+
/// <summary>
/// Creates a unique identifier.
Index: AbstractLoggingAdvice.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Logging/AbstractLoggingAdvice.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AbstractLoggingAdvice.cs 8 Oct 2007 22:05:16 -0000 1.1
--- AbstractLoggingAdvice.cs 6 Dec 2007 17:17:19 -0000 1.2
***************
*** 178,182 ****
/// <c>true</c> if log is for a given log level; otherwise, <c>false</c>.
/// </returns>
! private bool IsLogEnabled(ILog log)
{
return log.IsTraceEnabled;
--- 178,182 ----
/// <c>true</c> if log is for a given log level; otherwise, <c>false</c>.
/// </returns>
! protected virtual bool IsLogEnabled(ILog log)
{
return log.IsTraceEnabled;
|