Index: apps/app_verbose.c =================================================================== --- apps/app_verbose.c (revision 80660) +++ apps/app_verbose.c (working copy) @@ -55,7 +55,7 @@ static int verbose_exec(struct ast_channel *chan, void *data) { - int vsize; + double vsize; char *parse; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(level); @@ -73,27 +73,21 @@ args.level = "0"; } - if (sscanf(args.level, "%d", &vsize) != 1) { + if (sscanf(args.level, "%lf", &vsize) != 1) { vsize = 0; ast_log(LOG_WARNING, "'%s' is not a verboser number\n", args.level); } if (option_verbose >= vsize) { - switch (vsize) { - case 0: + if (vsize < 1) ast_verbose("%s\n", args.msg); - break; - case 1: + else if (vsize < 2) ast_verbose(VERBOSE_PREFIX_1 "%s\n", args.msg); - break; - case 2: + else if (vsize < 3) ast_verbose(VERBOSE_PREFIX_2 "%s\n", args.msg); - break; - case 3: + else if (vsize < 4) ast_verbose(VERBOSE_PREFIX_3 "%s\n", args.msg); - break; - default: + else ast_verbose(VERBOSE_PREFIX_4 "%s\n", args.msg); - } } return 0; Index: include/asterisk/options.h =================================================================== --- include/asterisk/options.h (revision 80660) +++ include/asterisk/options.h (working copy) @@ -112,9 +112,9 @@ extern struct ast_flags ast_options; -extern int option_verbose; +extern double option_verbose; extern int option_maxfiles; /*!< Max number of open file handles (files, sockets) */ -extern int option_debug; /*!< Debugging */ +extern double option_debug; /*!< Debugging */ extern int option_maxcalls; /*!< Maximum number of simultaneous channels */ extern double option_maxload; #if defined(HAVE_SYSINFO) Index: include/asterisk/logger.h =================================================================== --- include/asterisk/logger.h (revision 80660) +++ include/asterisk/logger.h (working copy) @@ -135,14 +135,14 @@ * \arg file the filename * \return the debug level */ -unsigned int ast_debug_get_by_file(const char *file); +double ast_debug_get_by_file(const char *file); /*! * \brief Get the debug level for a file * \arg file the filename * \return the debug level */ -unsigned int ast_verbose_get_by_file(const char *file); +double ast_verbose_get_by_file(const char *file); /*! * \brief Log a DEBUG message Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 80660) +++ main/asterisk.c (working copy) @@ -161,8 +161,8 @@ struct ast_flags ast_options = { AST_DEFAULT_OPTIONS }; -int option_verbose; /*!< Verbosity level */ -int option_debug; /*!< Debug level */ +double option_verbose; /*!< Verbosity level */ +double option_debug; /*!< Debug level */ double option_maxload; /*!< Max load avg on system */ int option_maxcalls; /*!< Max number of active calls */ int option_maxfiles; /*!< Max number of open file handles (files, sockets) */ @@ -357,9 +357,9 @@ ast_cli(fd, " Max. open file handles: %d\n", option_maxfiles); else ast_cli(fd, " Max. open file handles: Not set\n"); - ast_cli(fd, " Verbosity: %d\n", option_verbose); - ast_cli(fd, " Debug level: %d\n", option_debug); - ast_cli(fd, " Max load avg: %lf\n", option_maxload); + ast_cli(fd, " Verbosity: %.3f\n", option_verbose); + ast_cli(fd, " Debug level: %.3f\n", option_debug); + ast_cli(fd, " Max load avg: %.3f\n", option_maxload); #if defined(HAVE_SYSINFO) ast_cli(fd, " Min Free Memory: %ld MB\n", option_minmemfree); #endif @@ -2193,9 +2193,9 @@ pid = atoi(cpid); else pid = -1; - snprintf(tmp, sizeof(tmp), "core set verbose atleast %d", option_verbose); + snprintf(tmp, sizeof(tmp), "core set verbose atleast %.3f", option_verbose); fdprint(ast_consock, tmp); - snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug); + snprintf(tmp, sizeof(tmp), "core set debug atleast %.3f", option_debug); fdprint(ast_consock, tmp); if (ast_opt_mute) { snprintf(tmp, sizeof(tmp), "log and verbose output currently muted ('logger unmute' to unmute)"); @@ -2358,7 +2358,7 @@ for (v = ast_variable_browse(cfg, "options"); v; v = v->next) { /* verbose level (-v at startup) */ if (!strcasecmp(v->name, "verbose")) { - option_verbose = atoi(v->value); + option_verbose = atof(v->value); /* whether or not to force timestamping in CLI verbose output. (-T at startup) */ } else if (!strcasecmp(v->name, "timestamp")) { ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP); @@ -2368,7 +2368,7 @@ /* debug level (-d at startup) */ } else if (!strcasecmp(v->name, "debug")) { option_debug = 0; - if (sscanf(v->value, "%d", &option_debug) != 1) { + if (sscanf(v->value, "%lf", &option_debug) != 1) { option_debug = ast_true(v->value); } #if HAVE_WORKING_FORK Index: main/cli.c =================================================================== --- main/cli.c (revision 80660) +++ main/cli.c (working copy) @@ -53,7 +53,7 @@ * \brief map a debug or verbose value to a filename */ struct ast_debug_file { - unsigned int level; + double level; AST_RWLIST_ENTRY(ast_debug_file) entry; char filename[0]; }; @@ -87,10 +87,10 @@ ast_carefulwrite(fd, buf->str, strlen(buf->str), 100); } -unsigned int ast_debug_get_by_file(const char *file) +double ast_debug_get_by_file(const char *file) { struct ast_debug_file *adf; - unsigned int res = 0; + double res = 0; AST_RWLIST_RDLOCK(&debug_files); AST_LIST_TRAVERSE(&debug_files, adf, entry) { @@ -104,10 +104,10 @@ return res; } -unsigned int ast_verbose_get_by_file(const char *file) +double ast_verbose_get_by_file(const char *file) { struct ast_debug_file *adf; - unsigned int res = 0; + double res = 0; AST_RWLIST_RDLOCK(&verbose_files); AST_LIST_TRAVERSE(&verbose_files, adf, entry) { @@ -253,13 +253,13 @@ static char *handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - int oldval; - int newlevel; + double oldval; + double newlevel; int atleast = 0; int fd = a->fd; int argc = a->argc; char **argv = a->argv; - int *dst; + double *dst; char *what; struct debug_file_list *dfl; struct ast_debug_file *adf; @@ -313,7 +313,7 @@ atleast = 1; if (argc != e->args + atleast && argc != e->args + atleast + 1) return CLI_SHOWUSAGE; - if (sscanf(argv[e->args + atleast - 1], "%d", &newlevel) != 1) + if (sscanf(argv[e->args + atleast - 1], "%lf", &newlevel) != 1) return CLI_SHOWUSAGE; if (argc == e->args + atleast + 1) { unsigned int debug = (*what == 'C'); @@ -328,14 +328,14 @@ if (AST_RWLIST_EMPTY(dfl)) ast_clear_flag(&ast_options, debug ? AST_OPT_FLAG_DEBUG_FILE : AST_OPT_FLAG_VERBOSE_FILE); AST_RWLIST_UNLOCK(dfl); - ast_cli(fd, "%s was %d and has been set to 0 for '%s'\n", what, adf->level, fn); + ast_cli(fd, "%s was %.3f and has been set to 0 for '%s'\n", what, adf->level, fn); ast_free(adf); return CLI_SUCCESS; } if (adf) { if ((atleast && newlevel < adf->level) || adf->level == newlevel) { - ast_cli(fd, "%s is %d for '%s'\n", what, adf->level, fn); + ast_cli(fd, "%s is %.3f for '%s'\n", what, adf->level, fn); AST_RWLIST_UNLOCK(dfl); return CLI_SUCCESS; } @@ -353,7 +353,7 @@ AST_RWLIST_INSERT_TAIL(dfl, adf, entry); AST_RWLIST_UNLOCK(dfl); - ast_cli(fd, "%s was %d and has been set to %d for '%s'\n", what, oldval, adf->level, adf->filename); + ast_cli(fd, "%s was %.3f and has been set to %.3f for '%s'\n", what, oldval, adf->level, adf->filename); return CLI_SUCCESS; } @@ -365,9 +365,9 @@ ast_cli(fd, "%s is now OFF\n", what); else if (*dst > 0) { if (oldval == *dst) - ast_cli(fd, "%s is at least %d\n", what, *dst); + ast_cli(fd, "%s is at least %.3f\n", what, *dst); else - ast_cli(fd, "%s was %d and is now %d\n", what, oldval, *dst); + ast_cli(fd, "%s was %.3f and is now %.3f\n", what, oldval, *dst); } return CLI_SUCCESS;