We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed last year.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
由于没有可用的开放替代方案,因此决定实施这一点。
The decision is to implement this since no open alternatives are available.
最好的办法是使用您提到的相同日志库,但将特定于操作系统的代码(例如:行号、文件名、串行通信)与逻辑代码分开。操作系统特定的代码必须包含在函数或宏中,然后从逻辑代码中调用。
示例:
通过此功能,您只需更改每个设备的操作系统特定宏即可重复使用该库。
The best thing to do is to use the same logging library you mentioned but having the OS-specific codes (like: line number, file name, serial comms) separate from the logical code. The OS-specific code must be contained in functions or macros and then called in from the logical code.
Example:
With this you can re-use the library by just changing the OS specific Macros for each device.