Module: sip-router
Branch: master
Commit: fe00a3346a2276b25ae26160ce76bf658b5b826e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fe00a33…
Author: Elena-Ramona Modroiu <ramona(a)asipto.com>
Committer: Elena-Ramona Modroiu <ramona(a)asipto.com>
Date: Sat Sep 1 16:24:02 2012 +0200
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
---
cfg.lex | 2 ++
cfg.y | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/cfg.lex b/cfg.lex
index f986354..b0f4733 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -342,6 +342,7 @@ FORK_DELAY fork_delay
LOGSTDERROR log_stderror
LOGFACILITY log_facility
LOGNAME log_name
+LOGCOLOR log_color
LISTEN listen
ADVERTISE advertise|ADVERTISE
ALIAS alias
@@ -717,6 +718,7 @@ IMPORTFILE "import_file"
<INITIAL>{LOGSTDERROR} { yylval.strval=yytext; return LOGSTDERROR; }
<INITIAL>{LOGFACILITY} { yylval.strval=yytext; return LOGFACILITY; }
<INITIAL>{LOGNAME} { yylval.strval=yytext; return LOGNAME; }
+<INITIAL>{LOGCOLOR} { yylval.strval=yytext; return LOGCOLOR; }
<INITIAL>{LISTEN} { count(); yylval.strval=yytext; return LISTEN; }
<INITIAL>{ADVERTISE} { count(); yylval.strval=yytext; return ADVERTISE; }
<INITIAL>{ALIAS} { count(); yylval.strval=yytext; return ALIAS; }
diff --git a/cfg.y b/cfg.y
index 0ae0e40..37859aa 100644
--- a/cfg.y
+++ b/cfg.y
@@ -401,6 +401,7 @@ extern char *finame;
%token LOGSTDERROR
%token LOGFACILITY
%token LOGNAME
+%token LOGCOLOR
%token LISTEN
%token ADVERTISE
%token ALIAS
@@ -863,6 +864,8 @@ assign_stm:
| LOGFACILITY EQUAL error { yyerror("ID expected"); }
| LOGNAME EQUAL STRING { log_name=$3; }
| LOGNAME EQUAL error { yyerror("string value expected"); }
+ | LOGCOLOR EQUAL NUMBER { log_color=$3; }
+ | LOGCOLOR EQUAL error { yyerror("boolean value expected"); }
| DNS EQUAL NUMBER { received_dns|= ($3)?DO_DNS:0; }
| DNS EQUAL error { yyerror("boolean value expected"); }
| REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }