Browse code

core: log_color - new global parameter to enable colorful log messages

- enabled only when log_stderr=1
- equivalent of -e command parameter
- it can be: 0 - disabled (no colors, default); 1 - enabled

Elena-Ramona Modroiu authored on 01/09/2012 14:24:02
Showing 2 changed files
... ...
@@ -342,6 +342,7 @@ FORK_DELAY	fork_delay
342 342
 LOGSTDERROR	log_stderror
343 343
 LOGFACILITY	log_facility
344 344
 LOGNAME		log_name
345
+LOGCOLOR	log_color
345 346
 LISTEN		listen
346 347
 ADVERTISE	advertise|ADVERTISE
347 348
 ALIAS		alias
... ...
@@ -717,6 +718,7 @@ IMPORTFILE      "import_file"
717 717
 <INITIAL>{LOGSTDERROR}	{ yylval.strval=yytext; return LOGSTDERROR; }
718 718
 <INITIAL>{LOGFACILITY}	{ yylval.strval=yytext; return LOGFACILITY; }
719 719
 <INITIAL>{LOGNAME}	{ yylval.strval=yytext; return LOGNAME; }
720
+<INITIAL>{LOGCOLOR}	{ yylval.strval=yytext; return LOGCOLOR; }
720 721
 <INITIAL>{LISTEN}	{ count(); yylval.strval=yytext; return LISTEN; }
721 722
 <INITIAL>{ADVERTISE}	{ count(); yylval.strval=yytext; return ADVERTISE; }
722 723
 <INITIAL>{ALIAS}	{ count(); yylval.strval=yytext; return ALIAS; }
... ...
@@ -401,6 +401,7 @@ extern char *finame;
401 401
 %token LOGSTDERROR
402 402
 %token LOGFACILITY
403 403
 %token LOGNAME
404
+%token LOGCOLOR
404 405
 %token LISTEN
405 406
 %token ADVERTISE
406 407
 %token ALIAS
... ...
@@ -863,6 +864,8 @@ assign_stm:
863 863
 	| LOGFACILITY EQUAL error { yyerror("ID expected"); }
864 864
 	| LOGNAME EQUAL STRING { log_name=$3; }
865 865
 	| LOGNAME EQUAL error { yyerror("string value expected"); }
866
+	| LOGCOLOR EQUAL NUMBER { log_color=$3; }
867
+	| LOGCOLOR EQUAL error { yyerror("boolean value expected"); }
866 868
 	| DNS EQUAL NUMBER   { received_dns|= ($3)?DO_DNS:0; }
867 869
 	| DNS EQUAL error { yyerror("boolean value expected"); }
868 870
 	| REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }