Commit Graph

61 Commits

Author SHA1 Message Date
Martin Pulec
6c88f3b971 logger: fixed non-interactive crash when msg size < sizeof TERM_RESET 2022-11-02 10:20:09 +01:00
Martin Piatka
4b6a048752 logging: Wrap thread local buffer initialization in a function
resolves a crash on RPi
2022-10-26 17:05:26 +02:00
Martin Pulec
ab152abb04 audio testcard: error on WAV reading error
If WAV is used, error if size is 0 - it doesn't make any case to
continue and it will fil on floating point exception, anyways.
2022-10-10 09:28:37 +02:00
Martin Pulec
771637a91e added log_vprintf 2022-09-23 15:01:20 +02:00
Martin Pulec
f4f7b0c426 Logger: switch order of TERM_RESET and '\n'
If logged message ends with '\n', put TERM_RESET before it (it prevents
keeping the color if someone writes to stderr directly).
2022-09-15 10:59:40 +02:00
Martin Pulec
383a00844f DEBUG_TIMER: use time_ns_t 2022-08-10 13:45:07 +02:00
Martin Pulec
cf58ff3948 added missing includes 2022-08-10 13:45:07 +02:00
Martin Pulec
128150288b logger: removed preinit
no longer needed to initialize rang here
2022-08-10 10:00:07 +02:00
Martin Pulec
812bcbfc78 logger: remove ANSI seqences if not terminal
This allows use of raw ANSI sequences instead of the rang stuff.
2022-08-10 08:14:07 +02:00
Martin Pulec
7719e8aa47 logger: get rid of rang references 2022-08-10 08:14:07 +02:00
Martin Piatka
ca0421787a keyboard_control: use getter&setter for repeat skipping 2022-08-05 13:44:35 +02:00
Martin Piatka
386ea3ec16 logging: reset style only on tty 2022-08-03 13:16:03 +02:00
Martin Piatka
853015ecec logging: work around stringstream cast
The << operator for stringstream casts the result to basic_ostream
which does not have the .str() method on some compilers. (See C++ defect
report 1023).
2022-08-03 12:00:14 +02:00
Martin Piatka
ddcf2bf399 logging: Add submit_raw 2022-08-03 10:43:43 +02:00
Martin Piatka
332000e4b8 logging: check if output is a terminal only once 2022-08-03 10:43:43 +02:00
Martin Piatka
c0a9db6d0f logging: reserve space in buffer 2022-08-03 10:43:42 +02:00
Martin Piatka
04fbcddfed logging: expose styles as strings 2022-08-03 10:43:42 +02:00
Martin Piatka
c439b05887 logging: Log_out: nicer interface 2022-08-03 10:43:41 +02:00
Martin Piatka
d108c068f4 logging: Log_output: avoid using streams
Avoids an allocation and copy for timestamp
2022-08-03 10:43:41 +02:00
Martin Piatka
b4144ffa5b logging: put style reset into the msg buffer 2022-08-03 10:43:41 +02:00
Martin Piatka
241c930299 logging: Flush stream on msg repeat
Since the repeat msg does not contain a newline we need to flush the
stream to make sure it appears when stream buffering is used
2022-08-03 10:43:40 +02:00
Martin Piatka
e031547a1d logging: use mutex for repeated msg checking
The previous implementation using atomics was not entirely correct,
since the following situation could happen:

1. Thread 1 detects a msg repeat
2. Thread 2 prints a message before thread 1 could print repeat notice
3. Thread 1 outputs "last msg repeated" for the msg from step 1

The stdout stream uses locking internaly anyway, so this should not have
any significant overhead. On the other hand this simplifies the code,
eliminates an allocation and fixes the leak on exit.
2022-08-03 10:43:40 +02:00
Martin Piatka
65d7cf69b8 logging: Split timestamp and repeat functionality into its own class
This will eventually allow better integration with other formatting
functions like color_out, color_printf
2022-08-03 10:41:14 +02:00
Martin Piatka
44294ef0c6 logging: Logger: set color&style in constructor 2022-08-03 10:13:31 +02:00
Martin Pulec
ec20f7877c logger: trigger flush on repeated messages
When the output is line-buffered, the repeated message isn't immediately
printed.
2022-08-03 09:51:07 +02:00
Martin Piatka
d18fb0300e logging: Call preinit before parsing log config
Since help text containing ANSI escape codes can be shown during parsing
(i.e. on error or help text), preinit should be called sooner
2022-07-29 13:03:28 +02:00
Martin Piatka
d496f738f2 logging: setters for timestamp and skip_repeat 2022-07-29 13:03:28 +02:00
Martin Piatka
e1b51bda18 logging: separate config parsing from setting log level 2022-07-29 13:03:27 +02:00
Martin Piatka
07f245c5ec logging: Use enum for timestamp mode 2022-07-29 13:03:27 +02:00
Martin Pulec
a22ff7a5f1 lavc: debug dump spot for converted AVFrame
+ change first parameter of serialize callback to (const void *)
+ renamed "lavd-uncompressed" to "lavd-avframe" - uncompressed is vague
  since there are multiple forms of uncompressed - avframe, ultragrid
  pixfmt...
2021-11-26 12:19:17 +01:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Pulec
c84d62f4ed Logger: oneshot messages suppport 2021-11-05 10:39:33 +01:00
Martin Pulec
940399988a Lavd: option to dump decompressed frame 2021-10-22 09:21:52 +02:00
Martin Pulec
7510652dd6 Audio performance measurements
Added DEBUG_TIMER_START and DEBUG_TIMER_STOP to debug.h to for
performance measurements. If DEBUG is not defined, the code is not
compiled (doesn't impose any runtime overhead).
2021-08-04 11:01:22 +02:00
Martin Pulec
96844d7119 Audio: periodically display cumulative statistics 2021-07-27 16:13:24 +02:00
Martin Piatka
eab94c12c0 Remove some unused includes
Removes some unused includes reported by include-what-you-use
2021-06-08 15:22:25 +02:00
Martin Pulec
f8fd2f872e Logger: option to enable/disable timestamps 2021-05-26 16:15:39 +02:00
Martin Pulec
dd49b48b69 Added log_perror
Same as perror but uses the logger
2021-04-21 14:42:02 +02:00
Martin Pulec
dbc071fe81 Logger: fixed a leak 2021-04-19 16:59:25 +02:00
Martin Pulec
b888e09800 Key control: shortcut to control repeating of msgs 2020-11-13 14:50:29 +01:00
Martin Pulec
820d5c9c83 Logger: new line after last repeat count
To keep track about repetitions in output.
2020-11-05 09:26:09 +01:00
Martin Pulec
266b87fe09 Logger: force color output if both out&err are term
Force color output if both stdout and stderr are connected to terminal.
The setting is global and it is possible that only stdout is redirected
(eg. to pager) while the check here was for clog (cerr) only. Thus
escape sequences had been unintentionally output to the pipe.
2020-11-05 09:24:54 +01:00
Martin Pulec
024494f4b8 Option to disable message repeats suppressing 2020-11-05 09:21:33 +01:00
Martin Pulec
c2ff176904 Logger: suppress repeated messages 2020-11-05 09:07:45 +01:00
Martin Pulec
a36d5a008e Rang: force control
In order to control sequences work with ostringstream logger.
2020-11-05 09:07:04 +01:00
Martin Pulec
b1c96985d6 Logger: use ostringstream + clog 2020-11-05 09:06:07 +01:00
Martin Pulec
22da4e122b Logger: suppress some clang-tidy warning 2020-06-25 14:19:57 +02:00
Martin Pulec
508e33af1a rtpenc_h264.c: Missing config include
+ define ATTRIBUTE if not defined by config in debug
2019-11-23 13:07:51 +01:00
Martin Pulec
92a58c3f8c Indicate to compiler that color_out and log_msg are printf-alike
+ include config_* headers in some sources that don't (and include
  debug.h which now needs the ATTRIBUTE macro)
2019-11-21 16:51:03 +01:00
Martin Pulec
236f5b0589 Make: added target check and distcheck
+ added check for CppUnit
2019-11-19 08:22:50 +01:00