Visual Studio 添加添加跟踪
我一直在寻找编写/获取一个视觉工作室插件。
我希望能够在函数的顶部和底部编写描述性日志调用。
像这样
log.debug("TheClass.TheMethod(string TheStringParam ="+TheStringParam+") - in");
log.debug("TheClass.TheMethod(string TheStringParam ="+TheStringParam+") - out");
有一个adin可以做到这一点吗? 是否有任何地方可以提供像 Ghost Doc 这样的插件来进行反射(或其他) 解析参数之类的?
I was looking to write/get a visual studio addin.
I want to be able to write descriptive log calls at the top and bottom of a function.
like this
log.debug("TheClass.TheMethod(string TheStringParam ="+TheStringParam+") - in");
log.debug("TheClass.TheMethod(string TheStringParam ="+TheStringParam+") - out");
Is there an adin that does this?
Is there source anywhere for an add in like Ghost Doc that does reflection(or whatever) to
parse the parameters and such?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您可能想研究 AOP 来实现这一点。以下是 CodeProject 示例。这是关于它的博客文章。应该足以让你开始。
Sounds like you might want to look into AOP to achieve this. Here's a CodeProject example. Here's a blog post on it. Should be enough to get you started.
http://www.codeproject.com/KB/trace/LoggingDemo.aspx
http://www.codeproject.com/KB/trace/LoggingDemo.aspx
CodeRush 附带一项功能 (选择嵌入),它允许您选择代码/文本块,按下一个键并将该块包含在您选择的代码/文本中。
如果需要,可以在插入时根据周围的上下文计算该文本。许多内置的 StringProviders(令牌)都是开箱即用的,而其他的则可以根据您的需要相当容易地创建。
例如。 «?MethodName» StringProvider 是内置的,但需要完成一些工作(不多),以便创建 «?ParameterValues»
DXCore(CodeRush 构建的免费插件框架)允许创建 第 3 方插件可以与 CodeRush 一起运行或仅使用 DXCore 独立运行。可以创建这样的插件来将类似的逻辑应用于单个方法,或文件、类、项目或解决方案中的所有方法
CodeRush ships with a feature (Selection Embedding) which allows you to select a block of code/text, press a key and have the block wrapped in your choice of code/text.
This text can be calculated at the time of insertion based on the surrounding context if required. Many built it StringProviders (Tokens) are available out of the box, and others can be created fairly easily based on your needs.
For example. The «?MethodName» StringProvider is built in, but some work (not much) would need to be done, in order to create a «?ParameterValues»
The DXCore (The free plugin framework on which CodeRush was built) allows the creation of 3rd party plugins that can run alongside CodeRush or stand alone using just the DXCore. Such a plugin could be created to apply a similar logic to a single method, or all within a file, class, project or solution