Ticket #571: Coloring for logs in Linux/UNIX, two more spaces in logs and runtime log colors configuration (thanks Ondrej.Sterbak)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2159 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/include/pj/log.h b/pjlib/include/pj/log.h
index 76d609d..2d0961c 100644
--- a/pjlib/include/pj/log.h
+++ b/pjlib/include/pj/log.h
@@ -68,15 +68,17 @@
  */
 enum pj_log_decoration
 {
-    PJ_LOG_HAS_DAY_NAME   =   1, /**< Include day name [default: no].	     */
-    PJ_LOG_HAS_YEAR       =   2, /**< Include year digit [default: no]	     */
-    PJ_LOG_HAS_MONTH	  =   4, /**< Include month [default: no]	     */
-    PJ_LOG_HAS_DAY_OF_MON =   8, /**< Include day of month [default: no]     */
-    PJ_LOG_HAS_TIME	  =  16, /**< Include time [default: yes].	     */
-    PJ_LOG_HAS_MICRO_SEC  =  32, /**< Include microseconds [yes]             */
-    PJ_LOG_HAS_SENDER	  =  64, /**< Include sender in the log [yes].	     */
-    PJ_LOG_HAS_NEWLINE	  = 128, /**< Terminate each call with newline [yes].*/
-    PJ_LOG_HAS_CR	  = 256  /**< Include carriage return [no].	     */
+    PJ_LOG_HAS_DAY_NAME   =    1, /**< Include day name [default: no] 	      */
+    PJ_LOG_HAS_YEAR       =    2, /**< Include year digit [no]		      */
+    PJ_LOG_HAS_MONTH	  =    4, /**< Include month [no]		      */
+    PJ_LOG_HAS_DAY_OF_MON =    8, /**< Include day of month [no]	      */
+    PJ_LOG_HAS_TIME	  =   16, /**< Include time [yes]		      */
+    PJ_LOG_HAS_MICRO_SEC  =   32, /**< Include microseconds [yes]             */
+    PJ_LOG_HAS_SENDER	  =   64, /**< Include sender in the log [yes] 	      */
+    PJ_LOG_HAS_NEWLINE	  =  128, /**< Terminate each call with newline [yes] */
+    PJ_LOG_HAS_CR	  =  256, /**< Include carriage return [no] 	      */
+    PJ_LOG_HAS_SPACE	  =  512, /**< Include two spaces before log [yes]    */
+    PJ_LOG_HAS_COLOR	  = 1024  /**< Colorize logs [yes on win32]	      */
 };
 
 /**
@@ -199,6 +201,23 @@
 PJ_DECL(unsigned) pj_log_get_decor(void);
 
 
+/**
+ * Set color of log messages.
+ *
+ * @param level	    Log level which color will be changed.
+ * @param color	    Desired color.
+ */
+PJ_DECL(void) pj_log_set_color(int level, pj_color_t color);
+
+/**
+ * Get color of log messages.
+ *
+ * @param level	    Log level which color will be returned.
+ * @return	    Log color.
+ */
+PJ_DECL(pj_color_t) pj_log_get_color(int level);
+
+
 #else	/* #if PJ_LOG_MAX_LEVEL >= 1 */
 
 /**
@@ -236,6 +255,14 @@
 #  define pj_log_set_decor(decor)
 
 /**
+ * Set color of log messages.
+ *
+ * @param level	    Log level which color will be changed.
+ * @param color	    Desired color.
+ */
+#  define pj_log_set_color(level, color)
+
+/**
  * Get current maximum log verbositylevel.
  *
  * @return	    Current log maximum level.
@@ -249,6 +276,14 @@
  */
 #  define pj_log_get_decor()	0
 
+/**
+ * Get color of log messages.
+ *
+ * @param level	    Log level which color will be returned.
+ * @return	    Log color.
+ */
+#  define pj_log_get_color(level) 0
+
 
 #endif	/* #if PJ_LOG_MAX_LEVEL >= 1 */