首页 > 解决方案 > Unit test for Serilog write to console

问题描述

Application is in .net framework and using Serilog for logging.

Configuration

Logger = new LoggerConfiguration()
    .Enrich.FromLogContext()
    .MinimumLevel.Debug()
    .WriteTo.Console()
    .CreateLogger()

In Unit test how to verify that logger has the values which is expected to be?

Is there any way to read the values using any of Serilog api/methods?

标签: c#.netunit-testingserilogserilog-exceptions

解决方案


推荐阅读