Skip to content

Commit

Permalink
[apps] Fixed logfa handling in srt-live-transmit (#1647)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored Nov 10, 2020
1 parent 49dd2ec commit 8270f80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions apps/srt-live-transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int parse_args(LiveTransmitConfig &cfg, int argc, char** argv)
o_statspf = { "pf", "statspf" },
o_statsfull = { "f", "fullstats" },
o_loglevel = { "ll", "loglevel" },
o_logfa = { "logfa" },
o_logfa = { "lfa", "logfa" },
o_log_internal = { "loginternal"},
o_logfile = { "logfile" },
o_quiet = { "q", "quiet" },
Expand Down Expand Up @@ -238,20 +238,21 @@ int parse_args(LiveTransmitConfig &cfg, int argc, char** argv)
cerr << " -lfa <area...> - specify functional areas\n";
cerr << "Where:\n\n";
cerr << " <LEVEL>: fatal error note warning debug\n\n";
cerr << "This turns on logs that are at the given log name and all on the left.\n";
cerr << "(Names from syslog, like alert, crit, emerg, err, info, panic, are also\n";
cerr << "recognized, but they are aligned to those that lie close in hierarchy.)\n\n";
cerr << " <area...> is a space-sep list of areas to turn on or ~areas to turn off.\n\n";
cerr << "The list may include 'all' to turn all on or off, beside those selected.\n";
cerr << "Example: `-lfa ~all cc` - turns off all FA, except cc\n";
cerr << "Areas: general bstats control data tsbpd rexmit haicrypt cc\n";
cerr << "Default: all are on except haicrypt. NOTE: 'general' can't be off.\n\n";
cerr << "Turns on logs that are at the given log level or any higher level\n";
cerr << "(all to the left in the list above from the selected level).\n";
cerr << "Names from syslog, like alert, crit, emerg, err, info, panic, are also\n";
cerr << "recognized, but they are aligned to those that lie close in the above hierarchy.\n\n";
cerr << " <area...> is a coma-separated list of areas to turn on.\n\n";
cerr << "The list may include 'all' to turn all FAs on.\n";
cerr << "Example: `-lfa:sockmgmt,chn-recv` enables only `sockmgmt` and `chn-recv` log FAs.\n";
cerr << "Default: all are on except haicrypt. NOTE: 'general' FA can't be disabled.\n\n";
cerr << "List of functional areas:\n";

map<int, string> revmap;
for (auto entry: SrtLogFAList())
revmap[entry.second] = entry.first;

// Each group on a new line
int en10 = 0;
for (auto entry: revmap)
{
Expand Down Expand Up @@ -401,8 +402,12 @@ int main(int argc, char** argv)
// Set SRT log levels and functional areas
//
srt_setloglevel(cfg.loglevel);
for (set<srt_logging::LogFA>::iterator i = cfg.logfas.begin(); i != cfg.logfas.end(); ++i)
srt_addlogfa(*i);
if (!cfg.logfas.empty())
{
srt_resetlogfa(nullptr, 0);
for (set<srt_logging::LogFA>::iterator i = cfg.logfas.begin(); i != cfg.logfas.end(); ++i)
srt_addlogfa(*i);
}

//
// SRT log handler
Expand Down
2 changes: 1 addition & 1 deletion docs/srt-live-transmit.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ shell (using **"** **"** quotes or backslash).
- **-pf**, **-statspf** - SRT statistics print format. Values: json, csv, default.
- **-s**, **-stats**, **-stats-report-frequency** - The frequency of SRT statistics collection, based on the number of packets.
- **-loglevel** - lowest logging level for SRT, one of: *fatal, error, warning, note, debug* (default: *error*)
- **-logfa** - selected FAs in SRT to be logged (default: all is enabled, that is, you can filter out log messages from only wanted FAs using this option).
- **-logfa, -lfa** - selected FAs in SRT to be logged (default: all are enabled). See the list of FAs running `-help:logging`.
- **-logfile:logs.txt** - Output of logs is written to file logs.txt instead of being printed to `stderr`.
- **-help, -h** - Show help.
- **-version** - Show version info.
Expand Down

0 comments on commit 8270f80

Please sign in to comment.