Review Board 1.7.16


Verbose logging discrepancies

Review Request #2798 - Created Aug. 27, 2013 and submitted

Kevin Harwell
11
AST-1193
Reviewers
asterisk-dev
Asterisk
Refactored cases where a combination of ast_verbose/options_verbose were present.  Also in general tried to eliminate, in as many places as possible, where the options_verbose global variable was being used.  Refactored the way local and remote consoles handle verbose message logging in an attempt to solve the various discrepancies that sometimes would show between the two.
Tested several logging scenarios with various combinations of levels, messages, and consoles.  Also made sure the app_verbose and dumpchan were still working as expected after the changes.
branches/11/apps/app_dumpchan.c
Revision 397483 New Change
[20] 135 lines
[+20] [+] static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
136
		S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "(N/A)"),
136
		S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "(N/A)"),
137
		S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "(N/A)"),
137
		S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "(N/A)"),
138
		S_OR(ast_channel_dialed(c)->number.str, "(N/A)"),
138
		S_OR(ast_channel_dialed(c)->number.str, "(N/A)"),
139
		S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str, "(N/A)"),
139
		S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str, "(N/A)"),
140
		ast_channel_parkinglot(c),
140
		ast_channel_parkinglot(c),
141
		ast_channel_language(c),	
141
		ast_channel_language(c),
142
		ast_state2str(ast_channel_state(c)),
142
		ast_state2str(ast_channel_state(c)),
143
		ast_channel_state(c),
143
		ast_channel_state(c),
144
		ast_channel_rings(c), 
144
		ast_channel_rings(c),
145
		ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)),
145
		ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)),
146
		ast_getformatname(ast_channel_writeformat(c)),
146
		ast_getformatname(ast_channel_writeformat(c)),
147
		ast_getformatname(ast_channel_readformat(c)),
147
		ast_getformatname(ast_channel_readformat(c)),
148
		ast_getformatname(ast_channel_rawwriteformat(c)),
148
		ast_getformatname(ast_channel_rawwriteformat(c)),
149
		ast_getformatname(ast_channel_rawreadformat(c)),
149
		ast_getformatname(ast_channel_rawreadformat(c)),
[+20] [20] 7 lines
[+20] static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
157
		(long)ast_channel_whentohangup(c)->tv_sec,
157
		(long)ast_channel_whentohangup(c)->tv_sec,
158
		hour,
158
		hour,
159
		min,
159
		min,
160
		sec,
160
		sec,
161
		ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>",
161
		ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>",
162
		ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", 
162
		ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
163
		ast_channel_context(c),
163
		ast_channel_context(c),
164
		ast_channel_exten(c),
164
		ast_channel_exten(c),
165
		ast_channel_priority(c),
165
		ast_channel_priority(c),
166
		ast_print_group(cgrp, sizeof(cgrp), ast_channel_callgroup(c)),
166
		ast_print_group(cgrp, sizeof(cgrp), ast_channel_callgroup(c)),
167
		ast_print_group(pgrp, sizeof(pgrp), ast_channel_pickupgroup(c)),
167
		ast_print_group(pgrp, sizeof(pgrp), ast_channel_pickupgroup(c)),
[+20] [20] 12 lines
[+20] [+] static int dumpchan_exec(struct ast_channel *chan, const char *data)
180
	static char *line = "================================================================================";
180
	static char *line = "================================================================================";
181

    
   
181

   
182
	if (!ast_strlen_zero(data))
182
	if (!ast_strlen_zero(data))
183
		level = atoi(data);
183
		level = atoi(data);
184

    
   
184

   
185
	if (option_verbose >= level) {

   
186
		serialize_showchan(chan, info, sizeof(info));
185
	serialize_showchan(chan, info, sizeof(info));
187
		pbx_builtin_serialize_variables(chan, &vars);
186
	pbx_builtin_serialize_variables(chan, &vars);
188
		ast_verbose("\n"
187
	ast_verb(level, "\n"
189
			"Dumping Info For Channel: %s:\n"
188
		 "Dumping Info For Channel: %s:\n"
190
			"%s\n"
189
		 "%s\n"
191
			"Info:\n"
190
		 "Info:\n"
192
			"%s\n"
191
		 "%s\n"
193
			"Variables:\n"
192
		 "Variables:\n"
194
			"%s%s\n", ast_channel_name(chan), line, info, ast_str_buffer(vars), line);
193
		 "%s%s\n", ast_channel_name(chan), line, info, ast_str_buffer(vars), line);
195
	}

   
196

    
   
194

   
197
	return 0;
195
	return 0;
198
}
196
}
199

    
   
197

   
200
static int unload_module(void)
198
static int unload_module(void)
[+20] [20] 10 lines
branches/11/apps/app_verbose.c
Revision 397483 New Change
 
branches/11/channels/chan_misdn.c
Revision 397483 New Change
 
branches/11/main/asterisk.c
Revision 397483 New Change
 
branches/11/main/features.c
Revision 397483 New Change
 
branches/11/main/logger.c
Revision 397483 New Change
 
  1. branches/11/apps/app_dumpchan.c: Loading...
  2. branches/11/apps/app_verbose.c: Loading...
  3. branches/11/channels/chan_misdn.c: Loading...
  4. branches/11/main/asterisk.c: Loading...
  5. branches/11/main/features.c: Loading...
  6. branches/11/main/logger.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.