然后添加一些日志记录会非常容易.你可以装饰PackageService:
public class MyPackageService : IPackageService{ public MyPackageService(PackageService packageService) { _PackageService = packageService; } private Readonly PackageService _PackageService; public voID CreatePackage(httpContextBase context) { _PackageService.CreatePackage(context); } public voID DeletePackage(httpContextBase context) { _PackageService.DeletePackage(context); } public voID DownloadPackage(httpContextBase context) { // LOG HERE Log(context); _PackageService.DownloadPackage(context); } public voID PublishPackage(httpContextBase context) { _PackageService.PublishPackage(context); }}
然后将Routes.cs更改为重新绑定到MyPackageService.
public static class NuGetRoutes { public static voID Start() { Ninjectbootstrapper.Kernel.Rebind<IPackageService>().To<MyPackageService>(); MapRoutes(Routetable.Routes); } //...}总结
以上是内存溢出为你收集整理的c# – 如何在Nuget.Server上跟踪包下载?全部内容,希望文章能够帮你解决c# – 如何在Nuget.Server上跟踪包下载?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)