开发者

High performance logging library for embedded applications

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 soluti开发者_高级运维ons or at least similar ones?

Thanks in advance for any pointers/similar solutions,

Iulian


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜