diff options
author | Suraj Jitindar Singh <sjitindarsingh@gmail.com> | 2017-04-27 14:48:58 +1000 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2017-05-04 01:20:23 +0000 |
commit | 2851959877213f23fe5317b9a738d06db41a6666 (patch) | |
tree | efaa77cff69a17ae7b97a943fb7a25062c5cf46d /mboxd.c | |
parent | 5a3a0664b63feba8aff288a5691a9f873e4ea6eb (diff) | |
download | phosphor-mboxd-2851959877213f23fe5317b9a738d06db41a6666.tar.gz phosphor-mboxd-2851959877213f23fe5317b9a738d06db41a6666.zip |
mboxd: Introduce a new DEBUG log level
Currently there is no output on the console unless -v is specified on
the command line which enables error output. A second -v will provide
info output.
We probably want error output irrespective of whether a -v was given
on the command line because people generally want to know why their
program stopped working.
Make error output unconditional.
A single -v will give minimal informational output which is a good
level to see what the daemon is doing without barfing all over the
console.
A second -v will enable debug output which will print highly verbose
information which will be useful for debugging. Probably don't enable
this under normal circumstances.
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Change-Id: I3da25f7e4e9e976c17389fcceb1d85ef98de7e0a
Diffstat (limited to 'mboxd.c')
-rw-r--r-- | mboxd.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -92,10 +92,11 @@ static int poll_loop(struct mbox_context *context) strerror(errno)); } + MSG_DBG("Received signal: %d\n", info.ssi_signo); switch (info.ssi_signo) { case SIGINT: case SIGTERM: - MSG_OUT("Caught Signal - Exiting...\n"); + MSG_INFO("Caught Signal - Exiting...\n"); context->terminate = true; break; case SIGHUP: @@ -116,7 +117,9 @@ static int poll_loop(struct mbox_context *context) } } if (context->fds[DBUS_FD].revents & POLLIN) { /* DBUS */ - while ((rc = sd_bus_process(context->bus, NULL)) > 0); + while ((rc = sd_bus_process(context->bus, NULL)) > 0) { + MSG_DBG("DBUS Event\n"); + } if (rc < 0) { MSG_ERR("Error handling DBUS event: %s\n", strerror(-rc)); @@ -126,6 +129,7 @@ static int poll_loop(struct mbox_context *context) break; /* This should mean we clean up nicely */ } if (context->fds[MBOX_FD].revents & POLLIN) { /* MBOX */ + MSG_DBG("MBOX Event\n"); rc = dispatch_mbox(context); if (rc < 0) { MSG_ERR("Error handling MBOX event\n"); @@ -272,10 +276,10 @@ static bool parse_cmdline(int argc, char **argv, return false; } - MSG_OUT("Flash size: 0x%.8x\n", context->flash_size); + MSG_INFO("Flash size: 0x%.8x\n", context->flash_size); if (verbosity) { - MSG_OUT("%s logging\n", verbosity == MBOX_LOG_DEBUG ? "Debug" : + MSG_INFO("%s logging\n", verbosity == MBOX_LOG_DEBUG ? "Debug" : "Verbose"); } @@ -305,7 +309,7 @@ int main(int argc, char **argv) context->fds[i].fd = -1; } - MSG_OUT("Starting Daemon\n"); + MSG_INFO("Starting Daemon\n"); rc = init_signals(context, &set); if (rc) { @@ -349,13 +353,13 @@ int main(int argc, char **argv) goto finish; } - MSG_OUT("Entering Polling Loop\n"); + MSG_INFO("Entering Polling Loop\n"); rc = poll_loop(context); - MSG_OUT("Exiting Poll Loop: %d\n", rc); + MSG_INFO("Exiting Poll Loop: %d\n", rc); finish: - MSG_OUT("Daemon Exiting...\n"); + MSG_INFO("Daemon Exiting...\n"); clr_bmc_events(context, BMC_EVENT_DAEMON_READY, SET_BMC_EVENT); free_mboxd_dbus(context); |