High performance logging library for embedded applications

白昼怎懂夜的黑 提交于 2019-12-05 21:15:59

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:

#OS_LINE   _LINE_
#OS_FILE   _FILE_
#OS_SEND(a) Send(a)

int log(void)
{
   char msg[50];
   sprintf(msg, "line %i, %s", OS_LINE, OS_FILE);
   OS_SEND(msg);
   return 0;
}

With this you can re-use the library by just changing the OS specific Macros for each device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!