diff options
author | Karl Palsson <karlp@etactica.com> | 2020-02-26 11:20:17 +0000 |
---|---|---|
committer | Karl Palsson <karlp@etactica.com> | 2020-02-26 11:21:53 +0000 |
commit | 88fb4ac6b7f861fe6f83979917d218f565bb9cad (patch) | |
tree | f28719a21a2be80d512bfc6aa2aed21091dd1145 /net/pagekitec/patches | |
parent | af84a226f0ba6b89cb6fe14f8660543e956bf11b (diff) |
pagekite: avoid redundant information in syslog
Patch from upstream: https://github.com/pagekite/libpagekite/commit/7b4587818564aa667f868249e9a8f1dc1d095fd3
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Diffstat (limited to 'net/pagekitec/patches')
-rw-r--r-- | net/pagekitec/patches/01-Omit-redundant-times-when-logging-to-syslog.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/net/pagekitec/patches/01-Omit-redundant-times-when-logging-to-syslog.patch b/net/pagekitec/patches/01-Omit-redundant-times-when-logging-to-syslog.patch new file mode 100644 index 000000000..53c658bbf --- /dev/null +++ b/net/pagekitec/patches/01-Omit-redundant-times-when-logging-to-syslog.patch @@ -0,0 +1,44 @@ +From 7b4587818564aa667f868249e9a8f1dc1d095fd3 Mon Sep 17 00:00:00 2001 +From: "Bjarni R. Einarsson" <bre@klaki.net> +Date: Tue, 25 Feb 2020 16:10:11 +0000 +Subject: [PATCH] Omit redundant times when logging to syslog + +--- + libpagekite/pklogging.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/libpagekite/pklogging.c b/libpagekite/pklogging.c +index cf353f8..6129c30 100644 +--- a/libpagekite/pklogging.c ++++ b/libpagekite/pklogging.c +@@ -55,16 +55,25 @@ int pk_log(int level, const char* fmt, ...) + #else + struct timeval t; + char tsbuf[30]; ++# ifdef HAVE_DS_LOG_FORMAT + gettimeofday(&t, NULL); + strftime(tsbuf, sizeof(tsbuf), "%Y-%m-%d %H:%M:%S", localtime(&t.tv_sec)); +-# ifdef HAVE_DS_LOG_FORMAT + len = snprintf(output, 4000, "[%s.%03d][%x] ", + tsbuf, (int)t.tv_usec / 1000, (int) pthread_self()); + # else +- len = sprintf(output, "t=%s.%03d; ts=%x; tid=%x; ll=%x; msg=", +- tsbuf, (int)t.tv_usec / 1000, +- (int) time(0), (int) pthread_self(), +- logged_lines++); ++ if (log_file != NULL) { ++ gettimeofday(&t, NULL); ++ strftime(tsbuf, sizeof(tsbuf), "%Y-%m-%d %H:%M:%S", localtime(&t.tv_sec)); ++ len = sprintf(output, "t=%s.%03d; ts=%x; tid=%x; ll=%x; msg=", ++ tsbuf, (int)t.tv_usec / 1000, ++ (int) time(0), (int) pthread_self(), ++ logged_lines++); ++ } ++ else { ++ /* For syslog, we omit the times, syslog handles that. */ ++ len = sprintf(output, "tid=%x; ll=%x; msg=", ++ (int) pthread_self(), logged_lines++); ++ } + # endif + #endif + va_start(args, fmt); |