aboutsummaryrefslogtreecommitdiffstats
path: root/log.h
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-06-08 02:46:52 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-06-11 09:40:28 +0000
commitdc7f0b88bba0c703d9c802b153e145dc6b3dc549 (patch)
tree73dbaea334bb87e991332eeef828f85a8120b4d0 /log.h
parentc0f8812c31f5e9e0f86eb8a627034211dfb7431f (diff)
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.
Diffstat (limited to 'log.h')
-rw-r--r--log.h40
1 files changed, 0 insertions, 40 deletions
diff --git a/log.h b/log.h
deleted file mode 100644
index 8eb9df96dd..0000000000
--- a/log.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* log.h
- * log output definitions
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef __LOG_H__
-#define __LOG_H__
-
-/* capture domain (except for capture child, see below) */
-#define LOG_DOMAIN_CAPTURE "Capture"
-
-/* capture child domain (the capture child might also contain file domain messages!) */
-#define LOG_DOMAIN_CAPTURE_CHILD "CaptureChild"
-
-/* main domain */
-#define LOG_DOMAIN_MAIN "Main"
-
-/* enable very verbose capture log debug output */
-/* (might slightly degrade performance) */
-/*#define LOG_CAPTURE_VERBOSE*/
-
-#endif
-
-/*
- * Editor modelines - https://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 8
- * indent-tabs-mode: nil
- * End:
- *
- * vi: set shiftwidth=4 tabstop=8 expandtab:
- * :indentSize=4:tabSize=8:noTabs=true:
- */