From fb308a4f7db1edeb524be691598f9d3f48dbabb6 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Tue, 13 Mar 2012 01:36:38 +0000 Subject: modbuslog: Surround syslog outputs with brackets --- src/modbuslog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modbuslog.c b/src/modbuslog.c index 5142646..3b56290 100644 --- a/src/modbuslog.c +++ b/src/modbuslog.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) { openlog("modbuslog", SYSLOG_CONSOLE_OUTPUT | LOG_PID | LOG_CONS, LOG_USER); syslog(LOG_INFO, ""); - syslog(LOG_INFO, "modbuslog %s starting", VERSION_STRING); + syslog(LOG_INFO, "modbuslog [%s] starting", VERSION_STRING); syslog(LOG_INFO, ""); const char *configfile = "/etc/modbuslog.cfg"; @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) { } if (modbus_connect(ctx) == -1) { - syslog(LOG_ERR, "libmodbus: Connection failed: %s", + syslog(LOG_ERR, "libmodbus: Connection failed: [%s]", modbus_strerror(errno)); modbus_free(ctx); } @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) { break; } if (rc == -1) { - syslog(LOG_ERR, "libmodbus error: %s", + syslog(LOG_ERR, "libmodbus error: [%s]", modbus_strerror(errno)); } retry++; @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) { } else { // file doesn't exist. create it. syslog(LOG_NOTICE, "logfile does not exist"); - syslog(LOG_INFO, "creating file: %s", log_filename); + syslog(LOG_INFO, "creating file: [%s]", log_filename); FILE *fp = fopen(log_filename, "w"); fprintf( fp, @@ -291,7 +291,7 @@ int main(int argc, char *argv[]) { FILE *filehandle = fopen(log_filename, "a+"); - syslog(LOG_DEBUG, "opening file for append: %s", log_filename); + syslog(LOG_DEBUG, "opening file for append: [%s]", log_filename); int16_t registervalue = 0; @@ -328,7 +328,7 @@ int main(int argc, char *argv[]) { sprintf(interval_filename, "/var/modbuslog/interval/interval.txt"); - syslog(LOG_DEBUG, "opening interval file: %s", + syslog(LOG_DEBUG, "opening interval file: [%s]", interval_filename); FILE *intervalfile = fopen(interval_filename, "r+"); @@ -338,7 +338,7 @@ int main(int argc, char *argv[]) { } else { // file doesn't exist. create it. syslog(LOG_NOTICE, "interval file does not exist"); - syslog(LOG_INFO, "attempting to create file: %s", + syslog(LOG_INFO, "attempting to create file: [%s]", interval_filename); intervalfile = fopen(interval_filename, "w"); fprintf(intervalfile, "0\n"); @@ -371,7 +371,7 @@ int main(int argc, char *argv[]) { syslog( LOG_DEBUG, - "%i|%04i%02i%02i|%02i%02i%02i|%04i%02i%02i|%02i%02i%02i|%i|%i|%i\n", + "[%i|%04i%02i%02i|%02i%02i%02i|%04i%02i%02i|%02i%02i%02i|%i|%i|%i]\n", intervalid, utc.tm_year + 1900, utc.tm_mon + 1, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec, lc.tm_year + 1900, lc.tm_mon + 1, lc.tm_mday, -- cgit v1.2.3