Serilog 缺少什么命名空间? [英] What namespace and I missing for Serilog?
问题描述
我可以在带有各种 Serilog 接收器的 C# 代码中使用 LoggerConfiguration(),但我的编译器抱怨我使用.WriteTo.File"的规范.我很困惑,因为我已经能够在另一个演示解决方案中使用这个规范.我想知道是否需要添加某种程序集作为参考.我已经从包管理器控制台"运行了Install-Package Serilog.Sinks.File",但这似乎没有任何影响或变化.
我缺少什么指令或我需要什么程序集引用?我试图通过在线文档弄清楚这一点,但我找不到结果.
I am able to use LoggerConfiguration() in my C# code with various Serilog Sinks but my compiler is complaining about the specification of my use of ".WriteTo.File". I am confused because I have ben able to use this specification in another demo solution. I wonder if there is some sort of Assembly I need to add as a reference. I have run "Install-Package Serilog.Sinks.File" from the "Package Manager Console" but that did not seem to have any effect or change.
What directive am I missing or what assembly reference do I need?
I tried to figure this out via online documentation but I can not find the result.
推荐答案
您不会缺少命名空间.你缺少一个接收器......Serilog.Sinks.File.
You are not missing a namespace. You are missing a Sink... The Serilog.Sinks.File.
Install-Package Serilog.Sinks.File
<小时>
每次使用 WriteTo
.Something 时,都是在写入特定的接收器,需要将其添加到您的项目中.
Every time you use WriteTo
.Something, you're writing to a specific sink, which needs to be added to your project.
您可以在此处查看可以使用的可用接收器列表:https://github.com/serilog/serilog/wiki/Provided-Sinks
Here you can see a list of available sinks you can use: https://github.com/serilog/serilog/wiki/Provided-Sinks
这篇关于Serilog 缺少什么命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!