views:

141

answers:

2

Hello,

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

A: 

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.

Thanks. I will look into it. Though this doesn't offer me some actual efficiency when it comes to amount of transferred data. Probably I will have to implement this myself.
Iulian Şerbănoiu
A: 

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

Iulian Şerbănoiu