What namespace and I missing for Serilog?

痞子三分冷 提交于 2019-12-11 09:32:55

问题


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.


回答1:


You are not missing a namespace. You are missing a Sink... The Serilog.Sinks.File.

Install the Serilog.Sinks.File package from NuGet:

Install-Package Serilog.Sinks.File

Every time you use WriteTo.Something, you're writing to a specific sink, which needs to be added to your project.

Here you can see a list of available sinks you can use: https://github.com/serilog/serilog/wiki/Provided-Sinks



来源:https://stackoverflow.com/questions/55266385/what-namespace-and-i-missing-for-serilog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!