예제 #1
0
        public void Register()
        {
            LogManager.Configuration.AddTarget("DbLogger", this);
            LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, this));

            LogManager.ConfigurationReloaded += (sender, args) => Register();
            LogConfiguration.Reload();
        }
예제 #2
0
        public static void PreStart()
        {
            string logPath = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}-${{logger}}.log", HostingEnvironment.SiteName, new EnvironmentProvider().Version);
            string error   = string.Format("C:\\NLog\\{0}\\{1}\\${{shortdate}}_Error.log", HostingEnvironment.SiteName, new EnvironmentProvider().Version);

            LogConfiguration.RegisterUdpLogger();
            LogConfiguration.RegisterFileLogger(logPath, LogLevel.Trace);
            //LogConfiguration.RegisterFileLogger(error, LogLevel.Warn);
            LogConfiguration.Reload();

            logger.Info("Logger has been configured. (App Start)");
        }
예제 #3
0
        private static void InitilizeApp()
        {
            var environmentProvider = _container.Resolve <EnvironmentProvider>();

            ReportingService.RestProvider = _container.Resolve <RestProvider>();

            LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Info);
            LogConfiguration.RegisterConsoleLogger(LogLevel.Debug);
            LogConfiguration.RegisterUdpLogger();
            LogConfiguration.Reload();
            Logger.Info("Start-up Path:'{0}'", environmentProvider.ApplicationPath);
        }
예제 #4
0
        protected static void InitLogging()
        {
            if (LogManager.Configuration == null || LogManager.Configuration is XmlLoggingConfiguration)
            {
                LogManager.Configuration = new LoggingConfiguration();
                LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
                LogConfiguration.RegisterUdpLogger();

                RegisterExceptionVerification();
                LogConfiguration.Reload();
            }
        }
예제 #5
0
        private static void InitLoggers()
        {
            ReportingService.RestProvider = _container.Resolve <RestProvider>();

            LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
            LogConfiguration.RegisterUdpLogger();

            var logPath = Path.Combine(new EnvironmentProvider().GetSandboxLogFolder(), DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt");

            LogConfiguration.RegisterFileLogger(logPath, LogLevel.Info);

            LogConfiguration.Reload();
        }
예제 #6
0
        public IContainer BuildContainer()
        {
            var container = ContainerBuilder.Build();

            logger.Debug("Initializing Components");

            container.Resolve <DatabaseTarget>().Register();
            LogConfiguration.Reload();

            RegisterReporting(container);
            RegisterQuality(container);

            var indexers = container.Resolve <IEnumerable <IndexerBase> >();

            container.Resolve <IndexerProvider>().InitializeIndexers(indexers.ToList());

            var newznabIndexers = new List <NewznabDefinition>
            {
                new NewznabDefinition {
                    Enable = false, Name = "Nzbs.org", Url = "http://nzbs.org", BuiltIn = true
                },
                new NewznabDefinition {
                    Enable = false, Name = "Nzb.su", Url = "https://nzb.su", BuiltIn = true
                },
                new NewznabDefinition {
                    Enable = false, Name = "Dognzb.cr", Url = "https://dognzb.cr", BuiltIn = true
                }
            };

            container.Resolve <NewznabProvider>().InitializeNewznabIndexers(newznabIndexers);

            container.Resolve <JobProvider>().Initialize();
            container.Resolve <WebTimer>().StartTimer(30);

            var notifiers = container.Resolve <IEnumerable <ExternalNotificationBase> >();

            container.Resolve <ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());

            var providers = container.Resolve <IEnumerable <MetadataBase> >();

            container.Resolve <MetadataProvider>().Initialize(providers.ToList());

            //SignalR
            GlobalHost.DependencyResolver = new AutofacSignalrDependencyResolver(container.BeginLifetimeScope("SignalR"));

            return(container);
        }