PRE / POST中的WPP格式字符串 [英] WPP format string inside PRE/POST

查看:63
本文介绍了PRE / POST中的WPP格式字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在将所有基于文件的日志记录(旧版)转换为WPP跟踪。但是代码的某些部分,日志仍应写入文件。所以我想编写一个C / C ++宏,它接收日志消息并展开以同时进行WPP跟踪和基于文件的日志记录。



I am converting all file based logging (legacy) into WPP tracing. But some part of code, the logs should still be written into files. So I want to write a C/C++ macro which takes log message and expand to have both WPP tracing and file-based logging.

#define NEW_LOGGING(FORMAT_STRING,...)                                     \
    MyWppTrace(LEVEL_INFO, FLAG_CONTROLLER, FORMAT_STRING,__VA_ARGS__);    \ 
    Log_to_file(FORMAT_STRING,__VA_ARGS__);

我知道WPP预处理器在C宏预处理器之前运行,所以我认为唯一的方法是定义WPP PRE POST功能。所以我做了以下 

I got to know WPP preprocessor runs before C macro preprocessor, so I thought that the only way is to define WPP PRE POST function. So I did the below 

// MACRO: NEW_LOGGING
//
// begin_wpp config
// USEPREFIX (NEW_LOGGING,"%!STDPREFIX!");
// FUNC NEW_LOGGING{LEVEL=LEVEL_INFO,FLAGS=FLAG_CONTROLLER}(EXP,MSG,...);
// end_wpp
#define WPP_LEVEL_FLAGS_EXP_ENABLED(LEVEL, FLAGS, LogPrefix) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS)
#define WPP_LEVEL_FLAGS_EXP_LOGGER(LEVEL, FLAGS, LogPrefix) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS)

#define WPP_LEVEL_FLAGS_EXP_PRE(LEVEL, FLAGS, LogPrefix) Log_to_file(LogPrefix, (MSG));
#define WPP_LEVEL_FLAGS_EXP_POST(LEVEL, FLAGS, LogPrefix) //end

这个上面的函数仍然会出现自WPP消息格式以来的错误在文件记录功能Log_to_file中未正确使用字符串。任何人都可以建议我实现目标的最佳方式吗?

this above func still gives error since the WPP message format string is not used correctly inside file logging function, Log_to_file. Can anyone suggest me a optimal way to achieve my goal?

推荐答案


Guitar Guts,

感谢您在此处发帖。

>>由于WPP邮件格式字符串未正确使用,因此上面的func仍会出错内部文件记录功能,Log_to_file。任何人都可以建议我实现目标的最佳方式吗?

请提供有关错误的更多信息以及如何实现Log_to_file方法?

Please provide more information about your errors and how do you implement Log_to_file method?

据我所知,使用WPP软件跟踪记录消息与使用Windows事件记录服务类似。驱动程序在日志文件中记录消息ID和未格式化的二进制数据。随后,后处理器将日志文件
中的信息转换为人类可读的形式。

As far as I know, logging messages with WPP software tracing is similar to using Windows event logging services. The driver logs a message ID and unformatted binary data in a log file. Subsequently, a postprocessor converts the information in the log file to a human-readable form.

有关详细信息,请参阅以下文档。

For more information, please refer to this document below.

https://docs.microsoft.com/en -us / windows-hardware / drivers / devtest / wpp-software-tracing

此外,如果您正在处理驱动程序开发,我将帮助您将其移至Windows驱动程序开发论坛以获得更好的支持。

Besides, if you're dealing with driver development, I will help you move it to Windows driver development forum for better support.

您的理解与合作将不胜感激。

Your understanding and cooperation will be grateful.

最诚挚的问候,

Baron Bi

Baron Bi


这篇关于PRE / POST中的WPP格式字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆