Ejemplo n.º 1
0
        public void Fatal_WithStringAndParameters_ShouldCallHandler()
        {
            AmbientLogService sut     = new AmbientLogService();
            string            message = Guid.NewGuid().ToString();

            sut.Fatal(message, 1, 2);

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

            sut.Fatal(exception, message);

            _handler1.Received(1).Fatal(exception, message);
        }
        static void Main(string[] args)
        {
            ConfigureSerilog();
            ConfigureStatsDLoggingHandler();

            Logger.Information("Application starting");

            try
            {
                new NumberAdder().Add(3, 5);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex, "Exception from application");
            }

            Console.ReadLine();
        }