Action Item #510
closedAdd function[file:line] to prefix in pncLogger()
90%
Description
This can be done in libpibox by
- changing pncLogger() to _pncLogger()
- Adding const char*, const char *, int to the front of the args to _pncLogger()
- Adding a macro pncLogger() that wraps _pncLogger()
- 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.
Updated by Hammel almost 9 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().
Updated by Hammel almost 9 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:- timestamps
- restricting function/file/line to a reduced and uniform length.
After that I can close this issue.
Updated by Hammel over 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.