コード例 #1
0
 internal LoggingWrapper(Type clazz)
 {
     _logInterface = clazz;
     try
     {
         string loggingImplBaseName = LoggingSupportBaseName() + "_LoggingSupport" + ReflectPlatform
                                      .InnerClassSeparator + LoggingQualifiedBaseName();
         string loggerClassName = ReflectPlatform.AdjustClassName(loggingImplBaseName + "Logger"
                                                                  , clazz);
         string nullImplClassName = ReflectPlatform.AdjustClassName(loggingImplBaseName +
                                                                    "Adapter", clazz);
         Type logerClass = ReflectPlatform.ForName(loggerClassName);
         if (logerClass == null)
         {
             throw new ArgumentException("Cannot find logging support for " + ReflectPlatform.
                                         SimpleName(_logInterface));
         }
         _ctorLoggerClass = logerClass.GetConstructor(loggerConstructorParameterTypes);
         nullImpl         = (object)ReflectPlatform.CreateInstance(nullImplClassName);
     }
     catch (SecurityException e)
     {
         throw new Exception("Error accessing logging support for class " + clazz.FullName
                             , e);
     }
     catch (MissingMethodException e)
     {
         throw new Exception("Error accessing logging support for class " + clazz.FullName
                             , e);
     }
     trace = CreateProxy(Logger.Trace);
     debug = CreateProxy(Logger.Debug);
     info  = CreateProxy(Logger.Info);
     warn  = CreateProxy(Logger.Warn);
     error = CreateProxy(Logger.Error);
     fatal = CreateProxy(Logger.Fatal);
 }