Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ConfigureSerilog();
            Logger.Debug("Application starting");

            try
            {
                Settings settings = new Settings()
                {
                    TriggerAdapter              = "Test",
                    NotificationAdapter         = "Email",
                    PersistenceAdapter          = "Test",
                    PersistenceConnectionString = "server=127.0.0.1;" +
                                                  "uid=bookorder_service;" +
                                                  "pwd=123;" +
                                                  "database=bookorders"
                };

                Application application = new Application(settings);

                application.Configure();
                application.Run();

                System.Console.ReadLine();

                Logger.Debug("Application shutting down");
                application.Shutdown();
            }
            catch (Exception ex)
            {
                Logger.Error(ex, ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        public void Error_WithStringAndParameters_ShouldCallHandler()
        {
            AmbientLogService sut     = new AmbientLogService();
            string            message = Guid.NewGuid().ToString();

            sut.Error(message, 1, 2);

            _handler1.Received(1).Error(message, 1, 2);
        }
Ejemplo n.º 3
0
        public void Error_WithExceptionString_ShouldLogAsErrorToSerilog()
        {
            AmbientLogService sut     = new AmbientLogService();
            string            message = Guid.NewGuid().ToString();
            var exception             = new Exception();

            sut.Error(exception, message);

            sut.Instance.Received(1).Error(exception, message);
        }
Ejemplo n.º 4
0
        public void Error_WithExceptionString_ShouldCallHandler()
        {
            AmbientLogService sut     = new AmbientLogService();
            string            message = Guid.NewGuid().ToString();
            var exception             = new Exception();

            sut.Error(exception, message);

            _handler1.Received(1).Error(exception, message);
        }
Ejemplo n.º 5
0
        private void MonitorIISExpress()
        {
            while (!_shutdownMonitor)
            {
                Thread.Sleep(500);
                if (_process.HasExited)
                {
                    Console.WriteLine("iisexpress has exited");
                    string msg = "iisexpress process has exited";

                    _logger.Error(msg);
                    _hostControl.Stop();
                }
            }
        }
Ejemplo n.º 6
0
 private static void OnException(Exception ex)
 {
     _logger.Error(ex, "{Exception}");
 }