Add logging functions with selectable log output targets
authorSteven Luo <steven+maemo@steven676.net>
Sun, 21 Feb 2010 02:13:28 +0000 (18:13 -0800)
committerSteven Luo <steven+maemo@steven676.net>
Sun, 21 Feb 2010 02:13:28 +0000 (18:13 -0800)
commit663c89819b6990c99427d1cf5b0fcae21e4201bc
treeaa6007c008716eca4e2f01cbd7ed6c63bcdafd0e
parentef66c102d916ea842c8ba15f010bf04326e3a590
Add logging functions with selectable log output targets

Currently, our "logging" consists of a mix of printf(), perror(), and
other such calls which print output to stdout/stderr.  In normal usage,
browser-switchboard will be launched by D-Bus, which results in
stdout/stderr pointing to /dev/null and debugging output being lost.

To improve this situation, introduce a new set of logging functions
log_out() and log_perror(), and a log_config() which allows choosing the
log target.  These functions log to stdout by default, but also support
syslog output (to the LOG_USER facility, with priority LOG_DEBUG) and
disabling logging entirely.

Thanks to Faheem Pervez (qwerty12) for the suggestion.
log.c [new file with mode: 0644]
log.h [new file with mode: 0644]