Skip to content

Commit

Permalink
core: added --debug=val command line parameter
Browse files Browse the repository at this point in the history
- set the value for debug global parameter from command line, allows
negative values corresponding to L_XYZ levels
- alternative to -d which operated by incresing debug level starting
from 0
  • Loading branch information
miconda committed May 27, 2020
1 parent 531e288 commit 9b6ec0a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main.c
Expand Up @@ -169,7 +169,8 @@ Options:\n\
-b nr Maximum receive buffer size which will not be exceeded by\n\
auto-probing procedure even if OS allows\n\
-c Check configuration file for syntax errors\n\
-d Debugging mode (multiple -d increase the level)\n\
-d Debugging level control (multiple -d to increase the level from 0)\n\
--debug=val Debugging level value\n\
-D Control how daemonize is done:\n\
-D..do not fork (almost) anyway;\n\
-DD..do not daemonize creator;\n\
Expand Down Expand Up @@ -1931,6 +1932,7 @@ int main(int argc, char** argv)
{"loadmodule", required_argument, 0, KARGOPTVAL + 5},
{"modparam", required_argument, 0, KARGOPTVAL + 6},
{"log-engine", required_argument, 0, KARGOPTVAL + 7},
{"debug", required_argument, 0, KARGOPTVAL + 8},
{0, 0, 0, 0 }
};

Expand Down Expand Up @@ -1992,6 +1994,14 @@ int main(int argc, char** argv)
case KARGOPTVAL+7:
ksr_slog_init(optarg);
break;
case KARGOPTVAL+8:
debug_flag = 1;
default_core_cfg.debug=(int)strtol(optarg, &tmp, 10);
if ((tmp==0) || (*tmp)){
LM_ERR("bad debug level value: %s\n", optarg);
goto error;
}
break;

default:
if (c == 'h' || (optarg && strcmp(optarg, "-h") == 0)) {
Expand Down Expand Up @@ -2153,6 +2163,7 @@ int main(int argc, char** argv)
case KARGOPTVAL+5:
case KARGOPTVAL+6:
case KARGOPTVAL+7:
case KARGOPTVAL+8:
break;

/* long options */
Expand Down

0 comments on commit 9b6ec0a

Please sign in to comment.