当我运行我的 Saturn 应用程序时,我看到一些日志被写入控制台。
看起来他们是从 LogLevel.Info
开始的。我如何进行更详细的日志记录,即如何正确设置,例如LogLevel.Trace
?
最佳答案
一种方法是在土星中设置 logging
app builder :
let app = application {
pipe_through endpointPipe
router topRouter
url "http://0.0.0.0:8085/"
memory_cache
use_static "static"
use_gzip
logging configureLogging
}
你可以像这样进行配置:
let configureLogging (logging: ILoggingBuilder) =
logging.SetMinimumLevel(LogLevel.Trace) |> ignore
我发现的唯一土星例子是 here ,在土星样本中。有more对于 ASP.NET Core,在其之上构建了 Saturn。
默认日志级别为 indeed LogLevel.Info
:
If you don't explicitly set the minimum level, the default value is Information, which means that Trace and Debug logs are ignored.
Remember不要为生产设置 LogLevel.Trace
:
These messages may contain sensitive application data. These messages are disabled by default and should never be enabled in a production environment.
关于logging - 如何更改 F# Saturn Framework 中的日志级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51570112/