High performance logging library for embedded appl

2019-05-10 15:47发布

I am looking for a high performance logging library that I will use on an embedded device.

I also want to say that I previously used PaulBunyan logging library which provided an efficient method for transferring information.

[By efficient I meant it had a solution for transferring only the __LINE__ and __FILE__ when sending data through a low speed interface (SERIAL for example) - of course a __LINE__ __FILE__ mapping was previously made by scanning the code].

Do you know such solutions or at least similar ones?

Thanks in advance for any pointers/similar solutions,

Iulian

2条回答
祖国的老花朵
2楼-- · 2019-05-10 16:08

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.

查看更多
别忘想泡老子
3楼-- · 2019-05-10 16:14

The decision is to implement this since no open alternatives are available.

查看更多
登录 后发表回答