wireshark/wsutil
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
Experience has shown that:

  1. The current logging methods are not very reliable or practical.
A logging bitmask makes little sense as the user-facing interface (who
would want debug but not crtical messages for example?); it's
computer-friendly and user-unfriendly. More importantly the console
log level preference is initialized too late in the startup process
to be used for the logging subsystem and that fact raises a number
of annoying and hard-to-fix usability issues.

  2. Coding around G_MESSAGES_DEBUG to comply with our log level mask
and not clobber the user's settings or not create unexpected log misses
is unworkable and generally follows the principle of most surprise.
The fact that G_MESSAGES_DEBUG="all" can leak to other programs using
GLib is also annoying.

  3. The non-structured GLib logging API is very opinionated and lacks
configurability beyond replacing the log handler.

  4. Windows GUI has some special code to attach to a console,
but it would be nice to abstract away the rest under a single
interface.

  5. Using this logger seems to be noticeably faster.

Deprecate the console log level preference and extend our API to
implement a log handler in wsutil/wslog.h to provide easy-to-use,
flexible and dependable logging during all execution phases.

Log levels have a hierarchy, from most verbose to least verbose
(debug to error). When a given level is set everything above that
is also enabled.

The log level can be set with an environment variable or a command
line option (parsed as soon as possible but still later than the
environment). The default log level is "message".

Dissector logging is not included because it is not clear what log
domain they should use. An explosion to thousands of domains is
not desirable and putting everything in a single domain is probably
too coarse and noisy. For now I think it makes sense to let them do
their own thing using g_log_default_handler() and continue using the
G_MESSAGES_DEBUG mechanism with specific domains for each individual
dissector.

In the future a mechanism may be added to selectively enable these
domains at runtime while trying to avoid the problems introduced
by G_MESSAGES_DEBUG.
2021-06-11 09:40:28 +00:00
..
.editorconfig HTTPS In Even More Places, update some links. 2019-07-28 04:21:18 +00:00
802_11-utils.c wsutil: rename frequency-utils.[ch] to 802_11-utils.[ch]. 2021-03-04 15:41:00 -08:00
802_11-utils.h peektagged: guess the PHY for 11b/11g/11a. 2021-03-04 16:07:23 -08:00
CMakeLists.txt wslog: Include function name in ws_debug() output format 2021-06-06 19:48:53 +00:00
adler32.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
adler32.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
base32.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
base32.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
bits_count_ones.h HTTPS In Still More Places, update more URLs. 2019-07-27 22:56:35 +00:00
bits_ctz.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
bitswap.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
bitswap.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
buffer.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
buffer.h Fix function declaration of ws_buffer_length(). 2018-05-04 02:26:31 +00:00
cfutils.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
cfutils.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
codecs.c Avoid exposing HAVE_PLUGINS in the public API 2021-02-06 16:35:51 +00:00
codecs.h Avoid exposing HAVE_PLUGINS in the public API 2021-02-06 16:35:51 +00:00
color.h HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
copyright_info.c Happy New Year 2021 2021-01-01 11:36:23 +00:00
copyright_info.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
cpu_info.c wsutil: Strip the processor brand string. 2020-02-15 11:11:50 +00:00
cpu_info.h Move even more headers outside extern "C". 2021-03-16 04:33:00 -07:00
crash_info.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crash_info.h Clean up REPORT_DISSECTOR_BUG(). 2018-03-25 23:49:35 +00:00
crc5.c USBLL: Verify Token/Split packets CRC-5 2019-07-29 20:49:09 +00:00
crc5.h USBLL: Verify Token/Split packets CRC-5 2019-07-29 20:49:09 +00:00
crc6.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc6.h CRC6: Fixed CRC lookup table and functions 2019-01-04 06:04:07 +00:00
crc7.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc7.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
crc8.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc8.h The CRC8 routines don't modify the buffer; make the pointers to it const. 2018-02-17 19:30:35 +00:00
crc10.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc10.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
crc11.c Fix -Wdocumentation warning 2021-04-14 14:01:49 +00:00
crc11.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
crc16-plain.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc16-plain.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
crc16.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc16.h USBLL: Verify DATA packets CRC-16 2019-07-25 08:58:13 +00:00
crc32.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
crc32.h Rename airpdcap to dot11decrypt. 2018-02-24 11:56:18 +00:00
curve25519.c wsutil: fix build failure of Debian packages on Ubuntu 16.04 2019-06-30 13:07:43 +00:00
curve25519.h wsutil: fix build failure of Debian packages on Ubuntu 16.04 2019-06-30 13:07:43 +00:00
dot11decrypt_wep.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
eax.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
eax.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
epochs.h Put various epoch time deltas into wsutil/epochs.h. 2020-01-21 23:37:05 +00:00
file_util.c MSVC: Warn about unused formal parameters 2019-09-21 08:51:34 +00:00
file_util.h Move even more headers outside extern "C". 2021-03-16 04:33:00 -07:00
filesystem.c wsutil: Add filesystem write_file_binary_mode() 2021-06-07 06:24:28 +00:00
filesystem.h wsutil: Add filesystem write_file_binary_mode() 2021-06-07 06:24:28 +00:00
g711.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
g711.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
getopt_long.c MSVC: Warn about unused formal parameters 2019-09-21 08:51:34 +00:00
getopt_long.h wsutil: use SPDX identifiers. 2018-02-07 05:34:22 +00:00
glib-compat.c glib-compat: Fix build on Windows 2021-03-26 09:52:56 +01:00
glib-compat.h wsutils: add local implementation of g_memdup2. 2021-03-25 09:38:10 +00:00
inet_addr.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
inet_addr.h wsutil: fix WS_INET_ADDRSTRLEN definition on Windows 2018-05-11 18:24:15 +00:00
inet_ipv4.h ip: Reassemble across VLANs for publicly routable IPv4 addresses 2021-05-25 20:09:25 -04:00
inet_ipv6.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
interface.c Eliminate some unneeded header checks. 2018-05-16 22:03:09 +00:00
interface.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
jsmn.c wsutil: split libjsmn. 2016-09-30 20:12:00 +00:00
jsmn.h jsmn(.h): fix warning: '@param' command used in a comment that is not attached to a function declaration [-Wdocumentation] 2016-10-06 14:20:16 +00:00
json_dumper.c json_dumper: flush dumper before printing an error. 2019-03-22 22:30:24 +00:00
json_dumper.h json_dumper: add json_dumper_value_double 2019-02-11 05:09:58 +00:00
mpeg-audio.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
mpeg-audio.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
netlink.h Don't include config.h in system headers 2021-01-30 10:06:20 +00:00
nstime.c nstime: Remove an unneeded check. 2021-01-14 21:42:31 +00:00
nstime.h editcap: add support for epoch timestamps in `-A` and `-B` options 2021-01-11 18:01:08 +00:00
os_version_info.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
os_version_info.h Windows: Fetch our version using RtlGetVersion. 2018-06-26 20:30:02 +00:00
pint.h HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
please_report_bug.c Update our issue tracker URL in some places. 2020-09-16 01:29:07 +00:00
please_report_bug.h Add routines to return "Please report this as a bug" message strings. 2019-03-24 04:48:12 +00:00
plugins.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
plugins.h Move even more headers outside extern "C". 2021-03-16 04:33:00 -07:00
pow2.h Define macros to calculate (2^N)^M, and use them in more places. 2018-02-20 05:27:38 +00:00
privileges.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
privileges.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
processes.h Move even more headers outside extern "C". 2021-03-16 04:33:00 -07:00
report_message.c Add more error-reporting routines that call through a function pointer. 2021-03-15 12:17:59 -07:00
report_message.h Add more error-reporting routines that call through a function pointer. 2021-03-15 12:17:59 -07:00
rsa.c Refactor our logging and extend the wslog API 2021-06-11 09:40:28 +00:00
rsa.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
sign_ext.h Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
sober128.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
sober128.h wsutil/sober128: remove unused macros and functions 2017-02-02 21:13:55 +00:00
socket.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
socket.h wsutil: add netinet/in.h to socket.h. 2019-11-12 19:17:46 +00:00
str_util.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
str_util.h Add format_size_wmem 2019-12-02 05:01:16 +00:00
strnatcmp.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
strnatcmp.h wsutil: use SPDX identifiers. 2018-02-07 05:34:22 +00:00
strptime.c Fix many spelling errors 2020-10-11 08:35:55 +00:00
strptime.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
strtoi.c Replace g_assert() with ws_assert() in places 2021-06-06 20:05:26 +00:00
strtoi.h Add ws_strtoi() and ws_strtoui() routines and use them. 2020-02-25 08:27:52 +00:00
tempfile.c Fix -Wdocumentation warning 2021-04-14 14:01:49 +00:00
tempfile.h tempfile(.h): fix -Wdocumentation 2020-03-23 08:47:50 +00:00
time_util.c Add iso8601_to_nstime() for editcap and nettrace 2021-01-08 09:18:39 +00:00
time_util.h Move even more headers outside extern "C". 2021-03-16 04:33:00 -07:00
type_util.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
type_util.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
unicode-utils.c wsutil: argv[] is a NULL terminated array 2021-06-10 16:22:12 +00:00
unicode-utils.h Move even more headers outside extern "C". 2021-03-16 04:33:00 -07:00
utf8_entities.h Qt: Replace the toolbar extension icon. 2018-02-17 08:26:46 +00:00
win32-utils.c Refactor our logging and extend the wslog API 2021-06-11 09:40:28 +00:00
win32-utils.h Remove ABI compliance checker code. 2019-07-21 15:54:41 +00:00
ws_assert.h Try to avoid -Wunused with vanishing macros 2021-06-10 00:51:59 +01:00
ws_cpuid.h Fix many spelling errors 2020-10-11 08:35:55 +00:00
ws_mempbrk.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
ws_mempbrk.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
ws_mempbrk_int.h replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later. 2018-02-08 14:57:36 +00:00
ws_mempbrk_sse42.c Fix many spelling errors 2020-10-11 08:35:55 +00:00
ws_pipe.c Refactor our logging and extend the wslog API 2021-06-11 09:40:28 +00:00
ws_pipe.h HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
wsgcrypt.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
wsgcrypt.h wsutil: define HAVE_LIBGCRYPT_AEAD in wsutil/wsgcrypt.h. 2020-08-11 02:30:04 +00:00
wsgetopt.h wsutil: use SPDX identifiers. 2018-02-07 05:34:22 +00:00
wsjson.c Refactor our logging and extend the wslog API 2021-06-11 09:40:28 +00:00
wsjson.h NGAP: fix dissection of N2 Information Content 2019-06-16 11:30:24 +00:00
wslog.c Refactor our logging and extend the wslog API 2021-06-11 09:40:28 +00:00
wslog.h Refactor our logging and extend the wslog API 2021-06-11 09:40:28 +00:00
xtea.c HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
xtea.h HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00