コード例 #1
0
 public ConsoleOutLoggerFA(NameValueCollection properties)
 {
     try
     {
         this._Level = (IBatisNet.Common.Logging.LogLevel)Enum.Parse(typeof(IBatisNet.Common.Logging.LogLevel), properties["level"], true);
     }
     catch (Exception)
     {
         this._Level = IBatisNet.Common.Logging.LogLevel.All;
     }
     try
     {
         this._showDateTime = bool.Parse(properties["showDateTime"]);
     }
     catch (Exception)
     {
         this._showDateTime = true;
     }
     try
     {
         this._showLogName = bool.Parse(properties["showLogName"]);
     }
     catch (Exception)
     {
         this._showLogName = true;
     }
     this._dateTimeFormat = properties["dateTimeFormat"];
 }
コード例 #2
0
        protected override void Write(IBatisNet.Common.Logging.LogLevel level, object message, Exception e)
        {
            StringBuilder builder = new StringBuilder();

            if (this._showDateTime)
            {
                if (this._hasDateTimeFormat)
                {
                    builder.Append(DateTime.Now.ToString(this._dateTimeFormat, CultureInfo.InvariantCulture));
                }
                else
                {
                    builder.Append(DateTime.Now);
                }
                builder.Append(" ");
            }
            builder.Append(string.Format("[{0}]", level.ToString().ToUpper()).PadRight(8));
            if (this._showLogName)
            {
                builder.Append(this._logName).Append(" - ");
            }
            builder.Append(message.ToString());
            if (e != null)
            {
                builder.Append(Environment.NewLine).Append(e.ToString());
            }
            Trace.WriteLine(builder.ToString());
        }
コード例 #3
0
        protected override bool IsLevelEnabled(IBatisNet.Common.Logging.LogLevel level)
        {
            int num  = (int)level;
            int num2 = (int)this._currentLogLevel;

            return(num >= num2);
        }
コード例 #4
0
 public TraceLogger(string logName, IBatisNet.Common.Logging.LogLevel logLevel, bool showDateTime, bool showLogName, string dateTimeFormat)
 {
     this._logName         = logName;
     this._currentLogLevel = logLevel;
     this._showDateTime    = showDateTime;
     this._showLogName     = showLogName;
     this._dateTimeFormat  = dateTimeFormat;
     if ((this._dateTimeFormat != null) && (this._dateTimeFormat.Length > 0))
     {
         this._hasDateTimeFormat = true;
     }
 }
コード例 #5
0
 protected abstract void Write(IBatisNet.Common.Logging.LogLevel logLevel, object message, Exception e);
コード例 #6
0
 protected abstract bool IsLevelEnabled(IBatisNet.Common.Logging.LogLevel logLevel);