コード例 #1
0
        /// <summary>
        /// Create a new formatter instance to use for this Logger.
        /// Use the DefaultFormatterClass property.
        /// Subclasses may wish to override.
        /// </summary>
        /// <returns>A new formatter.</returns>
        protected virtual LogEntryFormatter GetDefaultFormatter()
        {
            LogEntryFormatter aFormatter = null;

            try
            {
                aFormatter = (LogEntryFormatter)DefaultFormatterClass.GetConstructor(new Type[0]).Invoke(new Object[0]);
            }
            catch (Exception)
            {
                aFormatter = new LogEntryStandardFormatter();
            }
            return(aFormatter);
        }
コード例 #2
0
ファイル: Logger.cs プロジェクト: bmxjumperc/ootd
 /// <summary>
 /// Create a new formatter instance to use for this Logger.
 /// Use the DefaultFormatterClass property.
 /// Subclasses may wish to override.
 /// </summary>
 /// <returns>A new formatter.</returns>
 protected virtual LogEntryFormatter GetDefaultFormatter()
 {
     LogEntryFormatter aFormatter = null;
     try
     {
         aFormatter = (LogEntryFormatter) DefaultFormatterClass.GetConstructor(new Type[] {typeof(LoggingErrorHandler)}).Invoke(new Object[] { new LoggingErrorHandler(OnLoggingError) });
     }
     catch (Exception ex)
     {
         OnLoggingError(this, "Error creating formatter", ex);
         aFormatter = new LogEntryStandardFormatter(OnLoggingError);
     }
     return aFormatter;
 }