参考项目代码:SwaggerDemoApi
打开nuget管理器--->搜索nlog,安装箭头所指的两个文件到你的项目中,config安装到你的API项目即可,nlog文件安装到你用得到nlog的项目中。
web.config文件不需要做任何配置,只需要在nlog.config文件中进行配置,只是给大家作为参考。
添加Logger.cs 帮助类。
仅供参考。