allow logging raw bytes via command line again

This commit is contained in:
john30
2017-04-23 12:08:35 +02:00
parent 43042eec9d
commit e6b6e17db3
3 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -116,7 +116,7 @@ static struct options opt = {
ll_COUNT, // logLevel
false, // multiLog
false, // logRaw
0, // logRaw
PACKAGE_LOGFILE, // logRawFile
100, // logRawSize
@@ -216,7 +216,8 @@ static const struct argp_option argpoptions[] = {
" [notice]", 0 },
{NULL, 0, NULL, 0, "Raw logging options:", 6 },
{"lograwdata", O_RAW, NULL, 0, "Log each received/sent byte on the bus", 0 },
{"lograwdata", O_RAW, "bytes", OPTION_ARG_OPTIONAL,
"Log messages or all received/sent bytes on the bus", 0 },
{"lograwdatafile", O_RAWFIL, "FILE", 0, "Write raw log to FILE [" PACKAGE_LOGFILE "]", 0 },
{"lograwdatasize", O_RAWSIZ, "SIZE", 0, "Make raw log file no larger than SIZE kB [100]", 0 },
@@ -504,7 +505,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) {
// Raw logging options:
case O_RAW: // --lograwdata
opt->logRaw = true;
opt->logRaw = arg && strcmp("bytes", arg) == 0 ? 2 : 1;
break;
case O_RAWFIL: // --lograwdatafile=/var/log/ebusd.log
if (arg == NULL || arg[0] == 0 || strcmp("/", arg) == 0) {
+1 -1
View File
@@ -74,7 +74,7 @@ struct options {
LogLevel logLevel; //!< log level [notice]
bool multiLog; //!< multiple log levels adjusted with --log=...
bool logRaw; //!< raw log each received/sent byte on the bus
unsigned int logRaw; //!< raw log each received/sent byte on the bus (1=messages, 2=bytes)
const char* logRawFile; //!< name of raw log file [/var/log/ebusd.log]
unsigned int logRawSize; //!< maximum size of raw log file in kB [100]
+2 -2
View File
@@ -119,8 +119,8 @@ MainLoop::MainLoop(const struct options opt, Device *device, MessageMap* message
} else {
m_logRawFile = NULL;
}
m_logRawEnabled = opt.logRaw;
m_logRawBytes = false;
m_logRawEnabled = opt.logRaw != 0;
m_logRawBytes = opt.logRaw == 2;
m_logRawLastReceived = true;
m_logRawLastSymbol = SYN;
if (opt.aclFile[0]) {