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); } }
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); }
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); }
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); }
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(); } } }
private static void OnException(Exception ex) { _logger.Error(ex, "{Exception}"); }