const char *console_fnkeys[12];
char loglevel[128];
int log_uuid;
+ int log_uuid_chars;
int quiet;
int batch_mode;
char prompt_color[12];
char output_text_color[12];
} cli_profile_t;
+static const int log_uuid_short_chars = 8;
static int is_color = 1;
static int warn_stop = 0;
static int connected = 0;
" -x, --execute=command Execute Command and Exit\n"
" -l, --loglevel=command Log Level\n"
" -U, --log-uuid Include UUID in log output\n"
+ " -S, --log-uuid-short Include shortened UUID in log output\n"
" -q, --quiet Disable logging\n"
" -r, --retry Retry connection on failure\n"
" -R, --reconnect Reconnect if disconnected\n"
printf("%s", colors[level]);
}
if (global_profile->log_uuid && !esl_strlen_zero(userdata)) {
- printf("%s ", userdata);
+ if (global_profile->log_uuid_chars) {
+ int len = strlen(userdata);
+ int i = (global_profile->log_uuid_chars < len) ? global_profile->log_uuid_chars : len;
+ fwrite(userdata, sizeof(char), i, stdout);
+ printf(" ");
+ } else {
+ printf("%s ", userdata);
+ }
}
printf("%s", handle->last_event->body);
if(!(global_profile->batch_mode)) {
esl_set_string(profiles[pcount-1].loglevel, val);
} else if(!strcasecmp(var, "log-uuid")) {
profiles[pcount-1].log_uuid = esl_true(val);
+ } else if(!strcasecmp(var, "log-uuid-short")) {
+ profiles[pcount-1].log_uuid = esl_true(val);
+ profiles[pcount-1].log_uuid_chars = (esl_true(val) ? log_uuid_short_chars : 0);
+ } else if(!strcasecmp(var, "log-uuid-chars")) {
+ int i;
+ if ((i = atoi(val)) > -1) {
+ profiles[pcount-1].log_uuid_chars = i;
+ }
} else if(!strcasecmp(var, "quiet")) {
profiles[pcount-1].quiet = esl_true(val);
} else if(!strcasecmp(var, "prompt-color")) {
{"execute", 1, 0, 'x'},
{"loglevel", 1, 0, 'l'},
{"log-uuid", 0, 0, 'U'},
+ {"log-uuid-short", 0, 0, 'S'},
{"quiet", 0, 0, 'q'},
{"batchmode", 0, 0, 'b'},
{"retry", 0, 0, 'r'},
char argv_command[1024] = "";
char argv_loglevel[128] = "";
int argv_log_uuid = 0;
+ int argv_log_uuid_short = 0;
int argv_quiet = 0;
int argv_batch = 0;
int loops = 2, reconnect = 0;
esl_global_set_default_logger(6); /* default debug level to 6 (info) */
for(;;) {
int option_index = 0;
- opt = getopt_long(argc, argv, "H:P:S:u:p:d:x:l:Ut:T:qrRhib?n", options, &option_index);
+ opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qrRhib?n", options, &option_index);
if (opt == -1) break;
switch (opt) {
case 'H':
case 'U':
argv_log_uuid = 1;
break;
+ case 'S':
+ argv_log_uuid_short = 1;
+ break;
case 'q':
argv_quiet = 1;
break;
if (argv_log_uuid) {
profile->log_uuid = 1;
}
+ if (argv_log_uuid_short) {
+ profile->log_uuid = 1;
+ profile->log_uuid_chars = log_uuid_short_chars;
+ }
esl_log(ESL_LOG_DEBUG, "Using profile %s [%s]\n", profile->name, profile->host);
esl_set_string(prompt_color, profile->prompt_color);
esl_set_string(input_text_color, profile->input_text_color);