summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-03-24 14:59:09 -0400
committerNick Mathewson <nickm@torproject.org>2015-03-24 14:59:09 -0400
commit25c3ff4500f912f3a9d19003bc6dab9cf6f00312 (patch)
treeb2ec1f75450986e4efe03873e6fbc88f45ff199c /src
parent112c554fcfc15a31198d38a46f6c4f7b8e901401 (diff)
parent7bed9dc73a6b95b2de741195ce54d073e0bd4a37 (diff)
downloadtor-25c3ff4500f912f3a9d19003bc6dab9cf6f00312.tar.gz
tor-25c3ff4500f912f3a9d19003bc6dab9cf6f00312.zip
Merge remote-tracking branch 'public/bug15269'
Diffstat (limited to 'src')
-rw-r--r--src/common/log.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 396eb6b0e8..4ad0bc3697 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -140,6 +140,9 @@ static size_t pending_startup_messages_len;
* configured. */
static int queue_startup_messages = 1;
+/** True iff __PRETTY_FUNCTION__ includes parenthesized arguments. */
+static int pretty_fn_has_parens = 0;
+
/** Don't store more than this many bytes of messages while waiting for the
* logs to get configured. */
#define MAX_STARTUP_MSG_LEN (1<<16)
@@ -313,7 +316,9 @@ format_msg(char *buf, size_t buf_len,
}
if (funcname && should_log_function_name(domain, severity)) {
- r = tor_snprintf(buf+n, buf_len-n, "%s(): ", funcname);
+ r = tor_snprintf(buf+n, buf_len-n,
+ pretty_fn_has_parens ? "%s: " : "%s(): ",
+ funcname);
if (r<0)
n = strlen(buf);
else
@@ -939,6 +944,11 @@ init_logging(int disable_startup_queue)
tor_mutex_init(&log_mutex);
log_mutex_initialized = 1;
}
+#ifdef __GNUC__
+ if (strchr(__PRETTY_FUNCTION__, '(')) {
+ pretty_fn_has_parens = 1;
+ }
+#endif
if (pending_cb_messages == NULL)
pending_cb_messages = smartlist_new();
if (disable_startup_queue)