summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-16 18:20:53 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-16 18:20:53 -0500
commite0b715e3aca0f5f1aaf3198c0e27e38d08358efe (patch)
tree9f70998d7a8289066d6039b98bb7546e7af1ac9a
parent73cec3e7c98c32c6e71639839afbf6c560a958ed (diff)
downloadgpsd-e0b715e3aca0f5f1aaf3198c0e27e38d08358efe.tar.gz
Introduce new LOG_CLIENT looging level.
-rw-r--r--gpsd.c10
-rw-r--r--gpsd.h-tail13
-rw-r--r--gpsmon.c3
-rw-r--r--gpspacket.c2
-rw-r--r--libgpsd_core.c3
5 files changed, 18 insertions, 13 deletions
diff --git a/gpsd.c b/gpsd.c
index ceb29c4d..95dbc98c 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -586,9 +586,9 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf,
{
ssize_t status;
- if (context.debug >= 3) {
+ if (context.debug >= LOG_CLIENT) {
if (isprint(buf[0]))
- gpsd_report(context.debug, LOG_IO,
+ gpsd_report(context.debug, LOG_CLIENT,
"=> client(%d): %s\n", sub_index(sub), buf);
else {
char *cp, buf2[MAX_PACKET_LENGTH * 3];
@@ -597,7 +597,7 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf,
(void)snprintf(buf2 + strlen(buf2),
sizeof(buf2) - strlen(buf2),
"%02x", (unsigned int)(*cp & 0xff));
- gpsd_report(context.debug, LOG_IO,
+ gpsd_report(context.debug, LOG_CLIENT,
"=> client(%d): =%s\n", sub_index(sub), buf2);
}
}
@@ -2257,7 +2257,7 @@ int main(int argc, char *argv[])
while ((rd = read(cfd, buf, sizeof(buf) - 1)) > 0) {
buf[rd] = '\0';
- gpsd_report(context.debug, LOG_IO,
+ gpsd_report(context.debug, LOG_CLIENT,
"<= control(%d): %s\n", cfd, buf);
/* coverity[tainted_data] Safe, never handed to exec */
handle_control(cfd, buf);
@@ -2326,7 +2326,7 @@ int main(int argc, char *argv[])
if (buf[buflen - 1] != '\n')
buf[buflen++] = '\n';
buf[buflen] = '\0';
- gpsd_report(context.debug, LOG_IO,
+ gpsd_report(context.debug, LOG_CLIENT,
"<= client(%d): %s\n", sub_index(sub), buf);
/*
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 50404475..a635f6c3 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -702,12 +702,13 @@ struct gps_device_t {
#define LOG_ERROR -1 /* errors, display always */
#define LOG_SHOUT 0 /* not an error but we should always see it */
#define LOG_WARN 1 /* not errors but may indicate a problem */
-#define LOG_INF 2 /* key informative messages */
-#define LOG_PROG 3 /* progress messages */
-#define LOG_IO 4 /* IO to and from devices */
-#define LOG_DATA 5 /* log data management messages */
-#define LOG_SPIN 6 /* logging for catching spin bugs */
-#define LOG_RAW 7 /* raw low-level I/O */
+#define LOG_CLIENT 2 /* log JSON reports to clients */
+#define LOG_INF 3 /* key informative messages */
+#define LOG_PROG 4 /* progress messages */
+#define LOG_IO 5 /* IO to and from devices */
+#define LOG_DATA 6 /* log data management messages */
+#define LOG_SPIN 7 /* logging for catching spin bugs */
+#define LOG_RAW 8 /* raw low-level I/O */
#define ISGPS_ERRLEVEL_BASE LOG_RAW
diff --git a/gpsmon.c b/gpsmon.c
index 20c8906d..b5ad7c35 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -575,6 +575,9 @@ void gpsd_report(const int debuglevel, const int errlevel, const char *fmt, ...)
case LOG_WARN:
err_str = "WARN: ";
break;
+ case LOG_CLIENT:
+ err_str = "CLIENT: ";
+ break;
case LOG_INF:
err_str = "INFO: ";
break;
diff --git a/gpspacket.c b/gpspacket.c
index 7a74adc7..1ce12dc1 100644
--- a/gpspacket.c
+++ b/gpspacket.c
@@ -273,6 +273,4 @@ initpacket(void)
PyModule_AddIntConstant(m, "RTCM2_PACKET", RTCM2_PACKET);
PyModule_AddIntConstant(m, "RTCM3_PACKET", RTCM3_PACKET);
PyModule_AddIntConstant(m, "JSON_PACKET", JSON_PACKET);
-
- PyModule_AddIntConstant(m, "LOG_IO", LOG_IO);
}
diff --git a/libgpsd_core.c b/libgpsd_core.c
index b7673af6..55ccc0ae 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -97,6 +97,9 @@ void gpsd_labeled_report(const int debuglevel, const int errlevel,
case LOG_WARN:
err_str = "WARN: ";
break;
+ case LOG_CLIENT:
+ err_str = "CLIENT: ";
+ break;
case LOG_INF:
err_str = "INFO: ";
break;