The usage of "+= snprintf" in print_preamble_header()/print_preamble() is wrong.
https://github.com/emilk/loguru/blob/bead38889d44d9fdb5c52916d1f26c4d6af09e66/loguru.hpp#L2329
Ref: http://www.cplusplus.com/reference/cstdio/snprintf/
- The type of argument
buf_sizeissize_t, butout_buff_size - posmay produce negative value. - The return value maybe negative if an encoding error occurs.
- If
out_buff_size == 0, there is no\0.
BTW, are g_preamble_* variables used to disable some fields (e.g. YYYYMMDD)? It will be useful
BTW, TERM=tmux does not mean 256 colors or 24-bit colors are not supported. tmux supports colors as long as the underlying terminal supports it.
If TERM=tmux is specified, which likely indicates the user specifies set -g default-terminal "tmux" (as it is not the default), the user may want to use enter_italics_mode, which means the terminal is unlikely monochrome.
return 0 == strcmp(term, "cygwin")
|| 0 == strcmp(term, "linux")
|| 0 == strcmp(term, "rxvt-unicode-256color")
|| 0 == strcmp(term, "screen")
|| 0 == strcmp(term, "screen-256color")
|| 0 == strcmp(term, "tmux-256color")
|| 0 == strcmp(term, "xterm")
|| 0 == strcmp(term, "xterm-256color")
|| 0 == strcmp(term, "xterm-termite")
|| 0 == strcmp(term, "xterm-color");
% TERM=xterm-termite-24bits tput setf24 65555 | cat -v # Emacs terminal 24-bit color rocks