Previously known as --compress.
Monitor mode is now done via --monitor.
Change-Id: If88daa7da4e9a222c8c674beb4f79c03c5a3bff0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
assert(sock_fd >= 0);
assert(!dump || !monitor);
- static const char compress_opt_str[] = " --compress ";
+ static const char compress_opt_str[] = " -m ";
size_t request_string_len = get_filter_size(filters) +
(compress ? (strlen(compress) + sizeof compress_opt_str - 1) : 0) +
- (dump ? 3 : 0) + // " -d"
- (monitor ? 3 : 0); // " -m"
+ (dump ? (sizeof " -d" - 1) : 0) +
+ (monitor ? (sizeof " --monitor" - 1) : 0);
if (MAX_LOGGER_REQUEST_LEN <= request_string_len)
return -E2BIG;
strncat(request_string, dump_str, request_string_len - len);
len += sizeof dump_str - 1;
} else if (monitor) {
- static const char monitor_str[] = " -m";
+ static const char monitor_str[] = " --monitor";
strncat(request_string, monitor_str, request_string_len - len);
len += sizeof monitor_str - 1;
}
if (pr.compression != NULL && pr.enabled_buffers != 0) {
/* This is dlogutil-specific; in daemon we actually use the -b value. */
- ERR("Error: -b and --compression can not be used together\n");
+ ERR("Error: -b and -m can not be used together\n");
return EXIT_FAILURE;
}
* backend would usually have. RECV_REAL should be universal. */
if (pr.compression) {
if (pr.action != ACTION_PRINT) {
- ERR("--compress and -g/-c currently unsupported\n");
+ ERR("-m and -g/-c currently unsupported\n");
return EXIT_FAILURE;
}
" -s Set default filter to silent.\n"
" Like specifying filterspec '*:s'\n"
" -f <filename> Log to file. Default to stdout\n"
+ " -m <memory area> Log to named memory area\n"
" -r [<kbytes>] Rotate log every kB (defaults to: " STRINGIFY(DEFAULT_ROTATE_SIZE_KB) "kB). Requires -f and -n > 0, else no rotation\n"
" -n <count> Sets max number of rotated logs to <count> (defaults to: " STRINGIFY(DEFAULT_ROTATE_NUM_FILES) "). Requires -f and -r > 0, else no rotation\n"
" -c clear (flush) the entire log and exit without printing logs\n"
- " -d dump the log and then exit (don't block unless also -m)\n"
- " -m only monitor the log (don't dump existing logs unless also -d)\n"
- " -t <count> print only the most recent <count> lines (implies -d but doesn't work with -m)\n"
+ " -d dump the log and then exit (don't block unless also --monitor)\n"
+ " -t <count> print only the most recent <count> lines (implies -d but doesn't work with --monitor)\n"
+ " --monitor only monitor the log (don't dump existing logs unless also -d)\n"
" -g get the size of the log's ring buffer and exit\n"
" -b <buffer> request alternate ring buffers (can use multiple)\n"
" ('main', 'radio', 'system', 'apps', 'kmsg', 'syslog')\n"
{"version" , no_argument, NULL, 2},
{"color" , required_argument, NULL, 3},
{"sort-by" , required_argument, NULL, 4},
- {"compress", required_argument, NULL, 5},
+ {"monitor" , no_argument, NULL, 5},
{"help" , no_argument, NULL, 'h'},
{0}
};
- int option = getopt_long(argc, argv, "cdmt:gsf:r:n:v:b:u:e:h", long_options, NULL);
+ int option = getopt_long(argc, argv, "cdm:t:gsf:r:n:v:b:u:e:h", long_options, NULL);
if (option < 0)
break;
}
break;
case 5: /* memory compression */
- mode = DLOGUTIL_MODE_COMPRESSED_MEMORY_DUMP;
- compression = optarg;
+ mode = DLOGUTIL_MODE_MONITOR;
break;
case 'd':
mode = DLOGUTIL_MODE_DUMP;
break;
case 'm':
- mode = DLOGUTIL_MODE_MONITOR;
+ mode = DLOGUTIL_MODE_COMPRESSED_MEMORY_DUMP;
+ compression = optarg;
break;
case 't':
mode = DLOGUTIL_MODE_DUMP;
assert(ops_pipe.prepare_print(&info, false, false, filter, NULL) == -1);
correct_request = DLOG_REQ_HANDLE_COMPRESSED_LOGUTIL;
- correct_send_data = "dlogutil -d --compress membackup --pid 456 --tid 123 filter1:V filter0:V *:S";
+ correct_send_data = "dlogutil -d -m membackup --pid 456 --tid 123 filter1:V filter0:V *:S";
correct_send_datalen = strlen(correct_send_data) + 1;
assert(ops_pipe.prepare_print(&info, false, false, filter, (char *) "membackup") == -1);
assert(info.fd == 2);
correct_request = DLOG_REQ_HANDLE_COMPRESSED_LOGUTIL;
- correct_send_data = "dlogutil -d --compress membackup --pid 456 --tid 123 filter1:V filter0:V *:S";
+ correct_send_data = "dlogutil -d -m membackup --pid 456 --tid 123 filter1:V filter0:V *:S";
correct_send_datalen = strlen(correct_send_data) + 1;
assert(ops_pipe.prepare_print(&info, false, false, filter, (char *) "membackup") == 0);
assert(info.fd == 3);
[ $WAS_ALIVE -eq 1 ] && [ "$(wc -l < "$TESTDIR"/dlog_continuous2_file)" -eq 11 ] && ok || fail
LOG_DETAILS="testing if the monitor mode works as expected (1/2)"
- dlogutil -mb main -f $TESTDIR/dlog_monitor1_file &
+ dlogutil --monitor -b main -f $TESTDIR/dlog_monitor1_file &
UTIL_PID=$!
sleep 1
kill $UTIL_PID && WAS_ALIVE=1 || WAS_ALIVE=0
[ $WAS_ALIVE -eq 1 ] && [ "$(wc -l < "$TESTDIR"/dlog_monitor1_file)" -eq 0 ] && ok || fail
LOG_DETAILS="testing if the monitor mode works as expected (2/2)"
- dlogutil -mb main -f $TESTDIR/dlog_monitor2_file &
+ dlogutil --monitor -b main -f $TESTDIR/dlog_monitor2_file &
UTIL_PID=$!
sleep 1
dlogsend -b main "Hi!"