Exemplo n.º 1
0
        private static ILog GetLogger(Type type)
        {
            var raw     = log4net.LogManager.GetLogger(type);
            var wrapped = new Log4NetWrapper(raw);

            return(wrapped);
        }
        private static ILog LogServiceRequested(ServiceProvider services)
        {
            // Init Common logger -> this will enable TVPlugin to write in the Mediaportal.log file
            var loggerName = Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]);
            var dataPath   = Configuration.Config.GetFolder(Configuration.Config.Dir.Config);
            var loggerPath = Configuration.Config.GetFolder(Configuration.Config.Dir.Log);

#if DEBUG
            if (loggerName != null)
            {
                loggerName = loggerName.Replace(".vshost", "");
            }
#endif
            CommonLogger.Instance = new CommonLog4NetLogger(loggerName, dataPath, loggerPath);

            // Init wrapper from CommonLogger to the current ILog interface
            // -> this will ensure that all external plugins will work without recompile
            ILog log = new Log4NetWrapper(); //LogImpl();
            services.Add <ILog>(log);
            return(log);
        }
Exemplo n.º 3
0
 public void Initialize()
 {
     this.log4NetWrapper = new Log4NetWrapper(typeof(LoggingTests));
 }
Exemplo n.º 4
0
 public ExceptionInterceptor()
     : this(Log4NetWrapper.GetLogger(MethodBase.GetCurrentMethod().DeclaringType))
 {
 }
 public void Setup()
 {
     wrapper = Substitute.For<Log4NetWrapper>();
     sut = new LoggerRepository(wrapper);
 }