コード例 #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);
            }
        }
コード例 #2
0
        public void Debug_WithStringAndParameters_ShouldCallHandler()
        {
            AmbientLogService sut     = new AmbientLogService();
            string            message = Guid.NewGuid().ToString();

            sut.Debug(message, 1, 2);

            _handler1.Received(1).Debug(message, 1, 2);
        }
コード例 #3
0
        public void Debug_WithExceptionString_ShouldCallHandler()
        {
            AmbientLogService sut     = new AmbientLogService();
            string            message = Guid.NewGuid().ToString();
            var exception             = new Exception();

            sut.Debug(exception, message);

            _handler1.Received(1).Debug(exception, message);
        }