Action Item #510

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

Added by Hammel over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:15 Mar 2016
Priority:ImmediateDue date:
Assignee:Hammel% Done:


Target version:0.11.0
Severity: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.

Associated revisions

Revision f7cca623
Added by Hammel over 1 year ago

RM #510: Add function, file and line to logs automatically by wrapping pncLogger() with a macro.

Revision dea1e5d2
Added by Hammel over 1 year ago

RM #510: Added configurable timestamps and header to log messages.

Revision 99fe34a8
Added by Hammel over 1 year ago

RM #510: Added configurable timestamps.

Revision f142df11
Added by Hammel over 1 year ago

RM #510: Added unit test for log format given new configuration timestamps and headers.


#1 Updated by Hammel over 1 year 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().

#2 Updated by Hammel over 1 year 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.

#3 Updated by Hammel over 1 year 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