Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger: choose logged instances by logger_topics file #14066

Merged
merged 1 commit into from
Jan 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/modules/logger/logged_topics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,11 @@ int LoggedTopics::add_topics_from_file(const char *fname)
continue;
}

// read line with format: <topic_name>[, <interval>]
// read line with format: <topic_name>[ <interval>[ <instance>]]
char topic_name[80];
uint32_t interval_ms = 0;
int nfields = sscanf(line, "%s %u", topic_name, &interval_ms);
uint32_t instance = 0;
int nfields = sscanf(line, "%s %u %u", topic_name, &interval_ms, &instance);

if (nfields > 0) {
int name_len = strlen(topic_name);
Expand All @@ -240,7 +241,8 @@ int LoggedTopics::add_topics_from_file(const char *fname)
}

/* add topic with specified interval_ms */
if (add_topic(topic_name, interval_ms)) {
if ((nfields > 2 && add_topic(topic_name, interval_ms, instance))
|| add_topic_multi(topic_name, interval_ms)) {
ntopics++;

} else {
Expand Down