diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 91836b7..e42d0bf 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -76,6 +76,7 @@ static int process_command(esl_handle_t *handle, const char *cmd); static int running = 1; static int thread_running = 0; +static switch_bool_t log_uuid = SWITCH_FALSE; static char *filter_uuid; @@ -565,6 +566,7 @@ static int usage(char *name){ printf(" -p, --password=password Password\n"); printf(" -x, --execute=command Execute Command and Exit\n"); printf(" -l, --loglevel=command Log Level\n"); + printf(" -U, --log-uuid Include UUID in log output\n"); printf(" -q, --quiet Disable logging\n"); printf(" -r, --retry Retry connection on failure\n"); printf(" -R, --reconnect Reconnect if disconnected\n"); @@ -607,10 +609,19 @@ static void *msg_thread_run(esl_thread_t *me, void *obj) #ifdef WIN32 SetConsoleTextAttribute(hStdout, COLORS[level]); + if (log_uuid && !esl_strlen_zero(userdata)) { + WriteFile(hStdout, userdata, strlen(userdata), &outbytes, NULL); + WriteFile(hStdout, " ", strlen(" "), &outbytes, NULL); + } WriteFile(hStdout, handle->last_event->body, len, &outbytes, NULL); SetConsoleTextAttribute(hStdout, wOldColorAttrs); #else - printf("%s%s%s", COLORS[level], handle->last_event->body, ESL_SEQ_DEFAULT_COLOR); + if (log_uuid && !esl_strlen_zero(userdata)) { + printf("%s%s %s%s", COLORS[level], userdata, handle->last_event->body, ESL_SEQ_DEFAULT_COLOR); + } + else { + printf("%s%s%s", COLORS[level], handle->last_event->body, ESL_SEQ_DEFAULT_COLOR); + } #endif } known++; @@ -988,6 +999,7 @@ int main(int argc, char *argv[]) {"debug", 1, 0, 'd'}, {"execute", 1, 0, 'x'}, {"loglevel", 1, 0, 'l'}, + {"log-uuid", 0, 0, 'U'}, {"quiet", 0, 0, 'q'}, {"retry", 0, 0, 'r'}, {"reconnect", 0, 0, 'R'}, @@ -1030,7 +1042,7 @@ int main(int argc, char *argv[]) for(;;) { int option_index = 0; - opt = getopt_long(argc, argv, "H:U:P:S:u:p:d:x:l:qrRh?", options, &option_index); + opt = getopt_long(argc, argv, "H:P:S:u:p:d:x:l:UqrRh?", options, &option_index); if (opt == -1) break; switch (opt) { @@ -1071,6 +1083,9 @@ int main(int argc, char *argv[]) case 'l': esl_set_string(argv_loglevel, optarg); break; + case 'U': + log_uuid = SWITCH_TRUE; + break; case 'q': argv_quiet = 1; break;