make erlang log less verbose and add erlang debug on|off to control
This commit is contained in:
parent
b2e28d68b5
commit
49dcd8c889
|
@ -501,7 +501,9 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
|
||||||
|
|
||||||
ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr);
|
ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds from %s for %s!\n", xmlstr, (int) (switch_micro_time_now() - now) / 1000, p->winner, uuid_str);
|
if (globals.debug) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds from %s for %s!\n", xmlstr, (int) (switch_micro_time_now() - now) / 1000, p->winner, uuid_str);
|
||||||
|
}
|
||||||
|
|
||||||
if (zstr(xmlstr)) {
|
if (zstr(xmlstr)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
|
||||||
|
@ -1677,9 +1679,20 @@ SWITCH_STANDARD_API(erlang_cmd)
|
||||||
if (!found)
|
if (!found)
|
||||||
stream->write_function(stream, "Could not find a listener for %s\n", argv[1]);
|
stream->write_function(stream, "Could not find a listener for %s\n", argv[1]);
|
||||||
|
|
||||||
|
} else if (!strcasecmp(argv[0], "debug")) {
|
||||||
|
if (argc == 2) {
|
||||||
|
if (!strcasecmp(argv[1], "on")) {
|
||||||
|
globals.debug = 1;
|
||||||
|
} else {
|
||||||
|
globals.debug = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream->write_function(stream, "+OK debug %s\n", globals.debug ? "on" : "off");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
stream->write_function(stream, "USAGE: erlang sessions <nodename>\n"
|
stream->write_function(stream, "USAGE: erlang sessions <nodename>\n"
|
||||||
" erlang listeners\n");
|
" erlang listeners\n"
|
||||||
|
" erlang debug <on|off>\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,7 @@ struct globals_struct {
|
||||||
unsigned int reference2;
|
unsigned int reference2;
|
||||||
char TIMEOUT; /* marker for a timed out request */
|
char TIMEOUT; /* marker for a timed out request */
|
||||||
char WAITING; /* marker for a request waiting for a response */
|
char WAITING; /* marker for a request waiting for a response */
|
||||||
|
int debug;
|
||||||
};
|
};
|
||||||
typedef struct globals_struct globals_t;
|
typedef struct globals_struct globals_t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue