From fb5690ce4b9ff896a56fe9b9eb9eeed1a2b5f028 Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Wed, 28 May 2014 22:54:12 +0000 Subject: Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messages This patch addresses some aesthetic issues in Asterisk. These are all just minor tweaks to improve the look of the CLI when used in a variety of settings. Specifically: * A number of chatty verbose messages were removed or demoted to DEBUG messages. Verbose messages with a verbosity level of 5 or higher were - if kept as verbose messages - demoted to level 4. Several messages that were emitted at verbose level 3 were demoted to 4, as announcement of dialplan applications being executed occur at level 3 (and so the effects of those applications should generally be less). * Some verbose messages that only appear when their respective 'debug' options are enabled were bumped up to always be displayed. * Prefix/timestamping of verbose messages were moved to the verboser handlers. This was done to prevent duplication of prefixes when the timestamp option (-T) is used with the CLI. * Verbose magic is removed from messages before being emitted to non-verboser handlers. This prevents the magic in multi-line verbose messages (such as SIP debug traces or the output of DumpChan) from being written to files. * _Slightly_ better support for the "light background" option (-W) was added. This includes using ast_term_quit in the output of XML documentation help, as well as changing the "Asterisk Ready" prompt to bright green on the default background (which stands a better chance of being displayed properly than bright white). Review: https://reviewboard.asterisk.org/r/3547/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/loader.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'main/loader.c') diff --git a/main/loader.c b/main/loader.c index e40cbf369..d4e94a622 100644 --- a/main/loader.c +++ b/main/loader.c @@ -185,7 +185,7 @@ void ast_module_register(const struct ast_module_info *info) mod = resource_being_loaded; } - ast_verb(5, "Registering module %s\n", info->name); + ast_debug(5, "Registering module %s\n", info->name); mod->info = info; AST_LIST_HEAD_INIT(&mod->users); @@ -232,7 +232,7 @@ void ast_module_unregister(const struct ast_module_info *info) AST_LIST_UNLOCK(&module_list); if (mod) { - ast_verb(5, "Unregistering module %s\n", info->name); + ast_debug(5, "Unregistering module %s\n", info->name); AST_LIST_HEAD_DESTROY(&mod->users); ast_free(mod); } @@ -440,20 +440,16 @@ static int is_module_loaded(const char *resource_name) char fn[PATH_MAX] = ""; void *lib; - ast_verb(10, "Checking if %s is loaded\n", resource_name); - snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_MODULE_DIR, resource_name); lib = dlopen(fn, RTLD_LAZY | RTLD_NOLOAD); if (lib) { - ast_verb(10, " %s loaded\n", resource_name); logged_dlclose(resource_name, lib); return 1; } - ast_verb(10, " %s not loaded\n", resource_name); return 0; } #endif @@ -843,7 +839,7 @@ enum ast_module_reload_result ast_module_reload(const char *name) } if (ast_mutex_trylock(&reloadlock)) { - ast_verbose("The previous reload command didn't finish yet\n"); + ast_verb(3, "The previous reload command didn't finish yet\n"); res = AST_MODULE_RELOAD_IN_PROGRESS; goto module_reload_exit; } @@ -859,7 +855,7 @@ enum ast_module_reload_result ast_module_reload(const char *name) } } if (res != AST_LOCK_SUCCESS) { - ast_verbose("Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR); + ast_log(AST_LOG_WARNING, "Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR); ast_mutex_unlock(&reloadlock); res = AST_MODULE_RELOAD_ERROR; goto module_reload_exit; @@ -977,12 +973,7 @@ static enum ast_module_load_result start_resource(struct ast_module *mod) switch (res) { case AST_MODULE_LOAD_SUCCESS: if (!ast_fully_booted) { - ast_verb(1, "%s => (%s)\n", mod->resource, term_color(tmp, mod->info->description, COLOR_BROWN, COLOR_BLACK, sizeof(tmp))); - if (ast_opt_console && !option_verbose) { - /* This never looks good on anything but the root console, so - * it's best not to try to funnel it through the logger. */ - fprintf(stdout, "."); - } + ast_verb(2, "%s => (%s)\n", mod->resource, term_color(tmp, mod->info->description, COLOR_BROWN, COLOR_BLACK, sizeof(tmp))); } else { ast_verb(1, "Loaded %s => (%s)\n", mod->resource, mod->info->description); } -- cgit v1.2.3