summaryrefslogtreecommitdiff
path: root/pjlib/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2011-09-18 14:38:46 +0000
committerBenny Prijono <bennylp@teluu.com>2011-09-18 14:38:46 +0000
commit8656f9c3676f6be0ad9c1f2603389ffab2dca8d2 (patch)
tree5c01062ddbb74084e8bcf130f49fc69d7947aa4e /pjlib/include
parentba9693beb7db082c1edd9930db3af1405700ac28 (diff)
Implemented re #1372: New log features: indentation and thread switching indication
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3752 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include')
-rw-r--r--pjlib/include/pj/config.h27
-rw-r--r--pjlib/include/pj/log.h23
2 files changed, 49 insertions, 1 deletions
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index 293e3f0f..cab05770 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -408,6 +408,33 @@
# define PJ_LOG_USE_STACK_BUFFER 1
#endif
+/**
+ * Enable log indentation feature.
+ *
+ * Default: 1
+ */
+#ifndef PJ_LOG_ENABLE_INDENT
+# define PJ_LOG_ENABLE_INDENT 1
+#endif
+
+/**
+ * Number of PJ_LOG_INDENT_CHAR to put every time pj_log_push_indent()
+ * is called.
+ *
+ * Default: 1
+ */
+#ifndef PJ_LOG_INDENT_SIZE
+# define PJ_LOG_INDENT_SIZE 1
+#endif
+
+/**
+ * Log indentation character.
+ *
+ * Default: space
+ */
+#ifndef PJ_LOG_INDENT_CHAR
+# define PJ_LOG_INDENT_CHAR '.'
+#endif
/**
* Colorfull terminal (for logging etc).
diff --git a/pjlib/include/pj/log.h b/pjlib/include/pj/log.h
index 83522d07..103469f9 100644
--- a/pjlib/include/pj/log.h
+++ b/pjlib/include/pj/log.h
@@ -81,7 +81,9 @@ enum pj_log_decoration
PJ_LOG_HAS_SPACE = 512, /**< Include two spaces before log [yes] */
PJ_LOG_HAS_COLOR = 1024, /**< Colorize logs [yes on win32] */
PJ_LOG_HAS_LEVEL_TEXT = 2048, /**< Include level text string [no] */
- PJ_LOG_HAS_THREAD_ID = 4096 /**< Include thread identification [no] */
+ PJ_LOG_HAS_THREAD_ID = 4096, /**< Include thread identification [no] */
+ PJ_LOG_HAS_THREAD_SWC = 8192, /**< Add mark when thread has switched [yes]*/
+ PJ_LOG_HAS_INDENT =16384 /**< Indentation. Say yes! [yes] */
};
/**
@@ -203,6 +205,25 @@ PJ_DECL(void) pj_log_set_decor(unsigned decor);
*/
PJ_DECL(unsigned) pj_log_get_decor(void);
+/**
+ * Add indentation to log message. Indentation will add PJ_LOG_INDENT_CHAR
+ * before the message, and is useful to show the depth of function calls.
+ *
+ * @param indent The indentation to add or substract. Positive value
+ * adds current indent, negative value subtracts current
+ * indent.
+ */
+PJ_DECL(void) pj_log_add_indent(int indent);
+
+/**
+ * Push indentation to the right by default value (PJ_LOG_INDENT).
+ */
+PJ_DECL(void) pj_log_push_indent(void);
+
+/**
+ * Pop indentation (to the left) by default value (PJ_LOG_INDENT).
+ */
+PJ_DECL(void) pj_log_pop_indent(void);
/**
* Set color of log messages.