Action Item #510


Add function[file:line] to prefix in pncLogger()

Added by Hammel about 8 years ago. Updated about 8 years ago.

Target version:
Start date:
15 Mar 2016
Due date:
% Done:


Estimated time:
01 - Critical


This can be done in libpibox by

  1. changing pncLogger() to _pncLogger()
  2. Adding const char*, const char *, int to the front of the args to _pncLogger()
  3. Adding a macro pncLogger() that wraps _pncLogger()
  4. Placing the gcc preprocessor defines FUNCTION, FILE and LINE in for the new args to _pncLogger()

Then apps just need to be recompiled with the updated library to use this.

Actions #1

Updated by Hammel about 8 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

This will be a little bit of work. First, I need to change the pncLogger() call to a macro and the function to _pncLogger(), being sure to export that from the library. I need to build and test this with the daemons and apps on the dev host. I should also format the log so function is fixed in size and so is file, so the logs line up nicely. I should add a timestamp option to the library that can be set with pncLoggerInit() or with a new API function. It might be nice to have pncLoggerInit() be an overloaded macro.

After fixing libpibox I may need rebuild libpiboxnet since multiple apps depend on it.

Then I need to rebuild the apps to make sure they all work. Only those that depend on libpibox are a concern (re: non-of the metabuilds, only my PiBox daemons and apps).

I need to commit the libs first, then the apps. The apps shouldn't need any changes but will get them if they use FUNCTION, FILE, or LINE in any existing calls to pncLogger().

Actions #2

Updated by Hammel about 8 years ago

  • % Done changed from 10 to 70

Recompiles was all that was required for libpnc and the apps. They all seem to be perfectly happy with that. I need to rebuild my local rpi tree with an updated libpibox so cross compiles will include that.

I want to look at adding config options to logging that allows:
  1. timestamps
  2. restricting function/file/line to a reduced and uniform length.

After that I can close this issue.

Actions #3

Updated by Hammel about 8 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 70 to 90

Done. Configurable timestamp and header (fixed or full) added to logs along with set/get functions to configure them.

Tested, committed and pushed.

Closing issue.


Also available in: Atom PDF