You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by rg...@apache.org on 2005/07/04 19:28:15 UTC

svn commit: r209101 - in /ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl: ConsoleOutLogger.cs TraceLogger.cs

Author: rgrabowski
Date: Mon Jul  4 10:28:13 2005
New Revision: 209101

URL: http://svn.apache.org/viewcvs?rev=209101&view=rev
Log:
Added check in constructor to see if a format for the date was passed in.

Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/ConsoleOutLogger.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/TraceLogger.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/ConsoleOutLogger.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/ConsoleOutLogger.cs?rev=209101&r1=209100&r2=209101&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/ConsoleOutLogger.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/ConsoleOutLogger.cs Mon Jul  4 10:28:13 2005
@@ -25,6 +25,7 @@
 #endregion
 
 using System;
+using System.Globalization;
 using System.Text;
 
 namespace IBatisNet.Common.Logging.Impl
@@ -39,6 +40,7 @@
 		private string _logName = string.Empty;
 		private LogLevel _currentLogLevel = LogLevel.All;
 		private string _dateTimeFormat = string.Empty;
+		private bool _hasDateTimeFormat = false;
 
 		/// <summary>
 		/// 
@@ -56,6 +58,11 @@
 			_showDateTime = showDateTime;
 			_showLogName = showLogName;
 			_dateTimeFormat = dateTimeFormat;
+
+			if (_dateTimeFormat != null && _dateTimeFormat.Length > 0)
+			{
+				_hasDateTimeFormat = true;
+			}
 		}
 
 		/// <summary>
@@ -75,7 +82,15 @@
 			// Append date-time if so configured
 			if ( _showDateTime )
 			{
-				sb.Append( DateTime.Now );
+				if ( _hasDateTimeFormat )
+				{
+					sb.Append( DateTime.Now.ToString( _dateTimeFormat, CultureInfo.InvariantCulture ));
+				}
+				else
+				{
+					sb.Append( DateTime.Now );
+				}
+				
 				sb.Append( " " );
 			}	
 			// Append a readable representation of the log level

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/TraceLogger.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/TraceLogger.cs?rev=209101&r1=209100&r2=209101&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/TraceLogger.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/Impl/TraceLogger.cs Mon Jul  4 10:28:13 2005
@@ -25,6 +25,7 @@
 #endregion
 
 using System;
+using System.Globalization;
 using System.Text;
 
 namespace IBatisNet.Common.Logging.Impl
@@ -39,6 +40,7 @@
 		private string _logName = string.Empty;
 		private LogLevel _currentLogLevel = LogLevel.All;
 		private string _dateTimeFormat = string.Empty;
+		private bool _hasDateTimeFormat = false;
 
 		/// <summary>
 		/// 
@@ -56,6 +58,11 @@
 			_showDateTime = showDateTime;
 			_showLogName = showLogName;
 			_dateTimeFormat = dateTimeFormat;
+
+			if (_dateTimeFormat != null && _dateTimeFormat.Length > 0)
+			{
+				_hasDateTimeFormat = true;
+			}
 		}
 
 		/// <summary>
@@ -75,7 +82,15 @@
 			// Append date-time if so configured
 			if ( _showDateTime )
 			{
-				sb.Append( DateTime.Now );
+				if ( _hasDateTimeFormat )
+				{
+					sb.Append( DateTime.Now.ToString( _dateTimeFormat, CultureInfo.InvariantCulture ));
+				}
+				else
+				{
+					sb.Append( DateTime.Now );
+				}
+				
 				sb.Append( " " );
 			}	
 			// Append a readable representation of the log level