From: <su...@us...> - 2007-11-19 20:42:41
|
Revision: 6598 http://openhpi.svn.sourceforge.net/openhpi/?rev=6598&view=rev Author: sutula Date: 2007-11-19 12:42:45 -0800 (Mon, 19 Nov 2007) Log Message: ----------- This change loosely associated with #issue #1804512, "Debug output occurring during normal operation". The watchdog plugin used to log the starting and stopping with an err() call. These are not errors, and should be debug, but debug information doesn't go to syslog, and it is helpful to have the start/stop information there. Implementing Andrew Cress's suggestion to continue to log watchdog start/stop, but not call it an error. Modified Paths: -------------- openhpi/trunk/include/oh_error.h openhpi/trunk/plugins/watchdog/watchdog.c Modified: openhpi/trunk/include/oh_error.h =================================================================== --- openhpi/trunk/include/oh_error.h 2007-11-19 19:50:00 UTC (rev 6597) +++ openhpi/trunk/include/oh_error.h 2007-11-19 20:42:45 UTC (rev 6598) @@ -61,6 +61,28 @@ #endif #ifdef OH_DBG_MSGS +#ifndef OH_DAEMON_ENABLED +#define warn(format, ...) \ + do { \ + if (getenv(OH_DBG) && !strcmp("YES", getenv(OH_DBG))) { \ + fprintf(stderr, " %s:%d:%s: ", __FILE__, __LINE__, __func__); \ + fprintf(stderr, format "\n", ## __VA_ARGS__); \ + } \ + } while(0) +#else +#define warn(format, ...) \ + do { \ + syslog(3, "WARNING: (%s, %d, "format")", __FILE__, __LINE__,## __VA_ARGS__); \ + if (getenv(OH_DBG) && !strcmp("YES", getenv(OH_DBG))) { \ + fprintf(stderr, "%s:%d ("format")\n", __FILE__, __LINE__, ## __VA_ARGS__); \ + } \ + } while(0) +#endif +#else +#define warn(format, ...) +#endif + +#ifdef OH_DBG_MSGS #define dbg(format, ...) \ do { \ if (getenv(OH_TRACE) && !strcmp("YES", getenv(OH_TRACE))) { \ Modified: openhpi/trunk/plugins/watchdog/watchdog.c =================================================================== --- openhpi/trunk/plugins/watchdog/watchdog.c 2007-11-19 19:50:00 UTC (rev 6597) +++ openhpi/trunk/plugins/watchdog/watchdog.c 2007-11-19 20:42:45 UTC (rev 6598) @@ -498,7 +498,7 @@ } else { if (SAHPI_TRUE == w.Running) { /* stop the watchdog device */ - err("Stop watchdog"); + warn("Watchdog timer stopped by OpenHPI"); if (-1 == write(wdtitems->fd, "V", 1)) { err("Unable to write to watchdog"); ret = SA_ERR_HPI_ERROR; @@ -564,7 +564,7 @@ if (wdtitems->data.Running == SAHPI_FALSE) { int timeout; - err("start up the watchdog"); + warn("Watchdog timer started by OpenHPI"); /* calling reset on stopped watchdog will */ /* cause the watchdog to start */ wdtitems->fd = open(wdtitems->path, O_RDWR); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |