History

fftools/opt_common: add time and datetime log flags

This commit adds two logging flags: 'time' and 'datetime'. Usage: ffmpeg -loglevel +time or ffmpeg -loglevel +datetime

softworkz committed 1 year ago

Commit 9fd23f71 parent c79cdae2 files · +16 −0Browse files

Unified · Split

2 files
  1. doc/fftools-common-opts.texi +4 −0
  2. fftools/opt_common.c +12 −0
doc/fftools-common-opts.texi+4−0
@@ -226,6 +226,10 @@ and the "Last message repeated n times" line will be omitted. · 225 unmodified lines
226226 Indicates that log output should add a @code{[level]} prefix to each message
227227 line. This can be used as an alternative to log coloring, e.g. when dumping the
228228 log to file.
229+@item time
230+Indicates that log lines should be prefixed with time information.
231+@item datetime
232+Indicates that log lines should be prefixed with date and time information.
229233 @end table
230234 Flags can also be used alone by adding a '+'/'-' prefix to set/reset a single
231235 flag without affecting other @var{flags} or changing @var{loglevel}. When
fftools/opt_common.c+12−0
@@ -1292,6 +1292,18 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) · 1291 unmodified lines
12921292 } else {
12931293 flags |= AV_LOG_PRINT_LEVEL;
12941294 }
1295+ } else if (av_strstart(token, "time", &arg)) {
1296+ if (cmd == '-') {
1297+ flags &= ~AV_LOG_PRINT_TIME;
1298+ } else {
1299+ flags |= AV_LOG_PRINT_TIME;
1300+ }
1301+ } else if (av_strstart(token, "datetime", &arg)) {
1302+ if (cmd == '-') {
1303+ flags &= ~AV_LOG_PRINT_DATETIME;
1304+ } else {
1305+ flags |= AV_LOG_PRINT_DATETIME;
1306+ }
12951307 } else {
12961308 break;
12971309 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t