mirror of https://github.com/asterisk/asterisk
commit
f4f3936d86
@ -0,0 +1,77 @@
|
|||||||
|
From df1ceb301c8a17969c467e3cf00246cfc28d1732 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Richard Mudgett <rmudgett@digium.com>
|
||||||
|
Date: Mon, 20 Feb 2017 12:19:05 -0600
|
||||||
|
Subject: [PATCH 1/5] r5554 svn backport Increase SENDER_WIDTH column size for
|
||||||
|
64-bit systems.
|
||||||
|
|
||||||
|
Re #1994 (misc): Make the log's sender and thread width a compile-time configurable setting.
|
||||||
|
|
||||||
|
Thanks to Richard Mudgett for the suggestion.
|
||||||
|
---
|
||||||
|
pjlib/include/pj/config.h | 27 +++++++++++++++++++++++++++
|
||||||
|
pjlib/src/pj/log.c | 4 ++--
|
||||||
|
2 files changed, 29 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
|
||||||
|
index 079d69b..3523f50 100644
|
||||||
|
--- a/pjlib/include/pj/config.h
|
||||||
|
+++ b/pjlib/include/pj/config.h
|
||||||
|
@@ -442,6 +442,33 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
+ * Log sender width.
|
||||||
|
+ *
|
||||||
|
+ * Default: 22 (for 64-bit machines), 14 otherwise
|
||||||
|
+ */
|
||||||
|
+#ifndef PJ_LOG_SENDER_WIDTH
|
||||||
|
+# if PJ_HAS_STDINT_H
|
||||||
|
+# include <stdint.h>
|
||||||
|
+# if (UINTPTR_MAX == 0xffffffffffffffff)
|
||||||
|
+# define PJ_LOG_SENDER_WIDTH 22
|
||||||
|
+# else
|
||||||
|
+# define PJ_LOG_SENDER_WIDTH 14
|
||||||
|
+# endif
|
||||||
|
+# else
|
||||||
|
+# define PJ_LOG_SENDER_WIDTH 14
|
||||||
|
+# endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Log thread name width.
|
||||||
|
+ *
|
||||||
|
+ * Default: 12
|
||||||
|
+ */
|
||||||
|
+#ifndef PJ_LOG_THREAD_WIDTH
|
||||||
|
+# define PJ_LOG_THREAD_WIDTH 12
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
* Colorfull terminal (for logging etc).
|
||||||
|
*
|
||||||
|
* Default: 1
|
||||||
|
diff --git a/pjlib/src/pj/log.c b/pjlib/src/pj/log.c
|
||||||
|
index 293ad46..cf7ac37 100644
|
||||||
|
--- a/pjlib/src/pj/log.c
|
||||||
|
+++ b/pjlib/src/pj/log.c
|
||||||
|
@@ -380,7 +380,7 @@ PJ_DEF(void) pj_log( const char *sender, int level,
|
||||||
|
pre += pj_utoa_pad(ptime.msec, pre, 3, '0');
|
||||||
|
}
|
||||||
|
if (log_decor & PJ_LOG_HAS_SENDER) {
|
||||||
|
- enum { SENDER_WIDTH = 14 };
|
||||||
|
+ enum { SENDER_WIDTH = PJ_LOG_SENDER_WIDTH };
|
||||||
|
pj_size_t sender_len = strlen(sender);
|
||||||
|
if (pre!=log_buffer) *pre++ = ' ';
|
||||||
|
if (sender_len <= SENDER_WIDTH) {
|
||||||
|
@@ -395,7 +395,7 @@ PJ_DEF(void) pj_log( const char *sender, int level,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (log_decor & PJ_LOG_HAS_THREAD_ID) {
|
||||||
|
- enum { THREAD_WIDTH = 12 };
|
||||||
|
+ enum { THREAD_WIDTH = PJ_LOG_THREAD_WIDTH };
|
||||||
|
const char *thread_name = pj_thread_get_name(pj_thread_this());
|
||||||
|
pj_size_t thread_len = strlen(thread_name);
|
||||||
|
*pre++ = ' ';
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
Loading…
Reference in new issue