Exemplo n.º 1
0
        public ExternalActionLogger(
            Action<string> writeAction,
            ICommonMessageSettings commonMessageSettings,
            ILogMessageFactory logMessageFactory
            )
        {
            if (writeAction == null)
            {
                throw new ArgumentNullException("writeAction");
            }
            if (commonMessageSettings == null)
            {
                throw new ArgumentNullException("commonMessageSettings");
            }
            if (logMessageFactory == null)
            {
                throw new ArgumentNullException("logMessageFactory");
            }

            _writeAction = writeAction;
            _commonMessageSettings = commonMessageSettings;
            _logMessageFactory = logMessageFactory;

            WriteHead();
        }
Exemplo n.º 2
0
        public EventLogLogger(ILogMessageFactory logMessageFactory)
        {
            this.logMessageFactory = logMessageFactory;

            eventLog = new EventLog("Application")
            {
                Source = "Application"
            };
        }
Exemplo n.º 3
0
        public FileMessageLogger(
            IFileCycling fileCycling,
            ILogMessageFactory logMessageFactory
            )
        {
            if (fileCycling == null)
            {
                throw new ArgumentNullException("fileCycling");
            }
            if (logMessageFactory == null)
            {
                throw new ArgumentNullException("logMessageFactory");
            }

            _fileCycling = fileCycling;
            _logMessageFactory = logMessageFactory;
        }
Exemplo n.º 4
0
 public MemoryLogSink(ILogMessageFactory logMessageFactory, INotificationService notificationService)
 {
     _logMessageFactory   = logMessageFactory ?? throw new ArgumentNullException(nameof(logMessageFactory));
     _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
 }
Exemplo n.º 5
0
 public DebugLogger(ILogMessageFactory logMessageFactory) : base(logMessageFactory)
 {
 }
Exemplo n.º 6
0
 public TraceLogger(ILogMessageFactory logMessageFactory) : base(logMessageFactory)
 {
 }
Exemplo n.º 7
0
 public ConsoleLogger(ILogMessageFactory logMessageFactory) : base(logMessageFactory)
 {
 }
Exemplo n.º 8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              ILogService logService,
                              ILogMessageFactory logMessageFactory,
                              IConnectionProvider connectionProvider,
                              IMqttRepository repository,
                              IMqttCommandAdapter commandAdapter,
                              IAdapterSettingService adapterSettingService,
                              IUiConfigurationService uiConfigurationService,
                              INotificationService notificationService,
                              ISettingsService settingsService,
                              IFileSystemService fileSystemService,
                              ILogFormatterService logFormatterService,
                              ILogFileService logFileService,
                              ISettingsProvider settingsProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            settingsProvider.ReadSettings();

            logService.RegisterSinks(new List <IlogSink>
            {
                new ConsoleLogSink(),
                new MemoryLogSink(logMessageFactory, notificationService),
                new FileLogSink(fileSystemService, logFormatterService, logFileService)
            });

            if (Debugger.IsAttached)
            {
                logService.RegisterSink(new DebugLogSink());
            }

            logService.Log(LogSeverity.Info, "Logging started.");

            var repo = new DatabaseRepository();

            repo.InitializeDatabase();

            commandAdapter.Initialize();
            connectionProvider.InitializeConnection();
            repository.Initialize();
            adapterSettingService.Initialize();
            uiConfigurationService.ReadAllConfigurationFiles();

            ConfigureSystemSpecifics(app.ApplicationServices);
            app.ApplicationServices.GetService <ICustomCommandConfigurationService>().ReloadConfiguration();
        }
Exemplo n.º 9
0
 public InMemoryLogger(ILogMessageFactory logMessageFactory) : base(logMessageFactory)
 {
 }
Exemplo n.º 10
0
 public StringLogger(ILogMessageFactory logMessageFactory)
 {
     this.logMessageFactory = logMessageFactory;
 }