diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2009-02-27 14:54:06 +0000 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2009-03-23 21:49:44 +1100 |
commit | a7908ed63584ff12653b37fb2c2548c52c8ed9da (patch) | |
tree | f4a8425369a16923abe3a01d4fd14059e7c11c7e /discover/pb-discover.c | |
parent | 642466026a078f7c2bf413e94aa720776300b604 (diff) | |
download | talos-petitboot-a7908ed63584ff12653b37fb2c2548c52c8ed9da.tar.gz talos-petitboot-a7908ed63584ff12653b37fb2c2548c52c8ed9da.zip |
Log server messages to file
Log discover server messages to a file. Helps in debugging
the server when is has problems at system startup.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Diffstat (limited to 'discover/pb-discover.c')
-rw-r--r-- | discover/pb-discover.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/discover/pb-discover.c b/discover/pb-discover.c index d8709b3..2b04e62 100644 --- a/discover/pb-discover.c +++ b/discover/pb-discover.c @@ -1,4 +1,5 @@ +#include <assert.h> #include <stdlib.h> #include <signal.h> @@ -21,6 +22,16 @@ int main(void) struct device_handler *handler; struct discover_server *server; struct udev *udev; + FILE *log; + + log = fopen("pb-discover.log", "a"); + assert(log); + pb_log_set_stream(log); + +#if defined(DEBUG) + pb_log_always_flush(1); +#endif + pb_log("--- pb-discover ---\n"); /* we look for closed sockets when we write, so ignore SIGPIPE */ signal(SIGPIPE, SIG_IGN); @@ -48,6 +59,7 @@ int main(void) device_handler_destroy(handler); + pb_log("--- end ---\n"); return EXIT_SUCCESS; } |