Module: kamailio
Branch: master
Commit: 9b6ec0a4912a617239395563cdd29233f65cb57d
URL: 
https://github.com/kamailio/kamailio/commit/9b6ec0a4912a617239395563cdd29233f65cb57d

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2020-05-27T13:36:42+02:00

core: added --debug=val command line parameter

- 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

---

Modified: src/main.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9b6ec0a4912a617239395563cdd29233f65cb57d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9b6ec0a4912a617239395563cdd29233f65cb57d.patch

---

diff --git a/src/main.c b/src/main.c
index 8926308ca5..e57bfa40f8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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\
@@ -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 }
        };
 
@@ -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)) {
@@ -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 */


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to