Commit Graph

66 Commits

Author SHA1 Message Date
Martin Pulec
7157b102a4 debug.cpp: fixed error in debug_file_dump
Not critical at all - the comma-separated option could not have been
used so far (it was intended to separate modules, but this funcion is
used in only one so far).
2023-05-10 08:52:01 +02:00
Martin Pulec
be4659469b log_msg_once updates
use static, not thread_local storage

This has an implications that the message is indeed printed once, even
though is called from 2 threads (this can happen eg. when printed once
during normal operation and then during module deletion, that may happen
in a different thread).
2023-04-24 13:50:33 +02:00
Martin Pulec
eb63ea9d37 log_vprintf: append TERM_RESET only if needed
It hasn't hurt but it is an extra work and there is no need to issue
clearing esc if no formatting was changed.
2023-04-12 12:52:41 +02:00
Martin Pulec
653cec55ab log_vprintf: return void instead of int
The returned value was actually incorrect (counting also formatting
escape sequences and terminating nul byte).

Since the return value should not be important for the caller, it is
perhaps better not to complicate and don't return anything.
2023-04-12 12:52:08 +02:00
Martin Pulec
c3b19d25da removed needless check/store of vsnprintf ret 2023-04-12 12:52:08 +02:00
Martin Pulec
602095e38a fixed some further snprintf warns
fixes warnings with Xcode 14.3 as in previous commit

+ allocate +1 in Log_output buffer - snprintf(MULL, 0...) returns number
  of bytes without terminating '\0'. std::string storage isn't guaranteed
  to be NULL-terminated (std::string("").at(0) throws an exception). The
  buffer is somewhere preallocated 256 which prevents problem but it's
  better not to rely upon it.
+ comment out some unused function in LDGM that also triggered the
  warning but looked a bit suspicious so it was not clear how to fix
2023-04-12 12:52:07 +02:00
Martin Pulec
cac1d11190 updated copyrights of files changed in 2023 2023-02-09 09:19:50 +01:00
Martin Pulec
2afcdf3c1f print which pixel format cannot be deinterlaced
Needs adding log_msg_once variable arguments (printf-like).

+ print always error in deinterlace - if user explicitly wants
  deinterlace PP, maybe we should notify loudly
2023-01-10 16:41:52 +01:00
Martin Pulec
e3574d3d66 one-shot logger updates
On one-shot second and further calls of one-shot message, no output was
producet, yet empty buffer was submitted to Log_output resulting in
false repeate messages:

    Last message repeated <n> times

To simplify the stuff, C++ API was removed and in the C API the Logger
is taken only if actual message will be output. If someone is willing to
use the C++ API, it can be later readded (not really needed now, only
simple message are presented).
2023-01-10 16:17:37 +01:00
Martin Pulec
9469d6352c document ULTRAGRID_VERBOSE + added some doxygen 2022-11-15 16:13:50 +01:00
Martin Piatka
344ddd5117 string_view_utils: Add sv_contains() 2022-11-10 12:04:41 +01:00
Martin Piatka
7cb9771962 Move tokenize and sv_parse_num into string_view_utils 2022-11-10 12:04:41 +01:00
Martin Pulec
6233c170dd debug_dump: (const void*) instead of (void*) param 2022-11-10 09:17:39 +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 Piatka
7e27491a2b logging: log_vprintf: prune ansi sequences when not interactive
Previously colored output using the inline TERM_* macros from color_out.h was
done only using the color_printf() function. Since there are now places
where they are used with log_msg(), we need to prune ansi codes here
too.
2022-09-27 14:12:18 +02:00
Martin Pulec
771637a91e added log_vprintf 2022-09-23 15:01:20 +02:00
Martin Pulec
78939c21d9 log_msg: switch order of TERM_RESET and '\n'
see also f4f7b0c4
2022-09-19 09:34:14 +02:00
Martin Pulec
a9bc710a73 respect ULTRAGRID_VEBOSE environment variable
Previously it was errorneously checked while setting log level from the
command-line opt. If no was given, the particular function was not run.
2022-08-17 17:24:35 +02:00
Martin Pulec
65557d112d get rid of rang.hpp dependency through color_out.h
Removed indirect dependency on rang.hpp through color_out.h. Now only
remaining dependencies on rang.hpp are direct.

+ fixed escape sequence for foreground magenta
2022-08-17 17:24:34 +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
7719e8aa47 logger: get rid of rang references 2022-08-10 08:14:07 +02:00
Martin Piatka
d395377a5d logging: debug_dump: simplify 2022-08-05 13:44:34 +02:00
Martin Piatka
60e6d00130 logging: remove old dead code 2022-08-05 13:44:34 +02:00
Martin Piatka
386ea3ec16 logging: reset style only on tty 2022-08-03 13:16:03 +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
33c8ac5c90 logging: log_msg(): Write directly to Log_output buffer 2022-08-03 10:43:42 +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
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
b77292d29e logging: modernize config parsing 2022-07-29 13:03:27 +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 Piatka
31b39db713 logging: Add missing assert 2022-07-29 13:03:26 +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
04734e0ebc Define ug_strerror for thread-safe strerror abstraction 2021-10-26 10:49:07 +02:00
Martin Pulec
940399988a Lavd: option to dump decompressed frame 2021-10-22 09:21:52 +02:00
Martin Pulec
a779d96c6d Logger: fixed wrong value message 2021-10-18 13:26:57 +02:00
Martin Pulec
8f1074cd74 GCC 11 warning workaround
GCC 11 gives incorrect warning for unintialized strerror_buf on
strerror_buf.size(), which is, however, compile-time constant. As a
workaround a separate size constant is used.
2021-10-14 10:52:47 +02:00
Martin Pulec
1fe5d8af1f Fixed parsing of log level debug2 2021-08-05 09:28:55 +02:00
Martin Pulec
34c8055dc8 Small include changes
To allow some files compile outside UltraGrid (without config.h) for
standalone convert.
2021-06-14 16:57:14 +02:00
Martin Pulec
f8fd2f872e Logger: option to enable/disable timestamps 2021-05-26 16:15:39 +02:00
Martin Pulec
f06204262b Use environment variable ULTRAGRID_VERBOSE 2021-05-26 14:48:53 +02:00
Martin Pulec
23c887d0a3 Debug: allow ANSI colors for MSYS
Assume that MSYS is capable of displaying ANSI sequences even if
setWinTermAnsiColors fails.
2021-05-20 13:42:15 +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
b888e09800 Key control: shortcut to control repeating of msgs 2020-11-13 14:50:29 +01:00
Martin Pulec
bd552be430 Allow verbosity increase with -V
+ small updates
2020-11-05 09:30:15 +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