forked from osmocom/wireshark
Replace usage of GLogLevel flags everywhere
ws_log_domains.h needs to be included before wslog.h to be used to define WS_LOG_DOMAIN. Also the definition for enum ws_log_level needs to be exported for other APIs so move that to ws_log_domains.h and rename the file to ws_log_defs.h to reflect the new scope.pespin/rlcmac
parent
02e34357bc
commit
ff9acff6f2
|
@ -3378,7 +3378,7 @@ set(SHARK_PUBLIC_HEADERS
|
|||
ws_attributes.h
|
||||
ws_compiler_tests.h
|
||||
ws_diag_control.h
|
||||
ws_log_domains.h
|
||||
ws_log_defs.h
|
||||
ws_symbol_export.h
|
||||
version_info.h
|
||||
${CMAKE_BINARY_DIR}/ws_version.h
|
||||
|
|
|
@ -380,6 +380,6 @@
|
|||
#endif
|
||||
|
||||
#include <ws_diag_control.h>
|
||||
#include <ws_log_domains.h>
|
||||
#include <ws_log_defs.h>
|
||||
|
||||
#endif /* __CONFIG_H__ */
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <glib.h>
|
||||
#include <epan/stat_groups.h>
|
||||
#include "ws_symbol_export.h"
|
||||
#include <ws_log_defs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -67,7 +68,7 @@ typedef struct _funnel_ops_t {
|
|||
void (*close_dialogs)(void);
|
||||
|
||||
void (*logger)(const gchar *log_domain,
|
||||
GLogLevelFlags log_level,
|
||||
enum ws_log_level log_level,
|
||||
const gchar *message,
|
||||
gpointer user_data);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <epan/ex-opt.h>
|
||||
#include <wsutil/privileges.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
/* linked list of Lua plugins */
|
||||
typedef struct _wslua_plugin {
|
||||
|
@ -605,11 +606,11 @@ static gboolean lua_load_plugin_script(const gchar* name,
|
|||
}
|
||||
|
||||
|
||||
static void basic_logger(const gchar *log_domain _U_,
|
||||
GLogLevelFlags log_level _U_,
|
||||
static void basic_logger(const gchar *log_domain,
|
||||
enum ws_log_level log_level,
|
||||
const gchar *message,
|
||||
gpointer user_data _U_) {
|
||||
fputs(message,stderr);
|
||||
ws_log(log_domain, log_level, "%s", message);
|
||||
}
|
||||
|
||||
static int wslua_panic(lua_State* LS) {
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <lualib.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
#include <ws_log_defs.h>
|
||||
|
||||
#include <wiretap/wtap.h>
|
||||
|
||||
#include <wsutil/report_message.h>
|
||||
|
@ -56,7 +58,7 @@
|
|||
#define WSLUA_INIT_ROUTINES "init_routines"
|
||||
#define WSLUA_PREFS_CHANGED "prefs_changed"
|
||||
|
||||
typedef void (*wslua_logger_t)(const gchar *, GLogLevelFlags, const gchar *, gpointer);
|
||||
typedef void (*wslua_logger_t)(const gchar *, enum ws_log_level, const gchar *, gpointer);
|
||||
extern wslua_logger_t wslua_logger;
|
||||
|
||||
/* type conversion macros - lua_Number is a double, so casting isn't kosher; and
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "ws_attributes.h"
|
||||
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
void register_tap_listener_funnel(void);
|
||||
|
||||
struct _funnel_text_window_t {
|
||||
|
@ -64,12 +66,11 @@ static const gchar *text_window_get_text(funnel_text_window_t *tw) {
|
|||
return tw->text->str;
|
||||
}
|
||||
|
||||
/* XXX: finish this */
|
||||
static void funnel_logger(const gchar *log_domain _U_,
|
||||
GLogLevelFlags log_level _U_,
|
||||
static void funnel_logger(const gchar *log_domain,
|
||||
enum ws_log_level log_level,
|
||||
const gchar *message,
|
||||
gpointer user_data _U_) {
|
||||
fputs(message, stderr);
|
||||
ws_log(log_domain, log_level, "%s", message);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "epan/funnel.h"
|
||||
#include "epan/prefs.h"
|
||||
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
#include "ui/progress_dlg.h"
|
||||
#include "ui/simple_dialog.h"
|
||||
|
||||
|
@ -37,7 +39,7 @@
|
|||
// - Add a FunnelGraphDialog class?
|
||||
|
||||
extern "C" {
|
||||
static void funnel_statistics_logger(const gchar *, GLogLevelFlags, const gchar *message, gpointer);
|
||||
static void funnel_statistics_logger(const gchar *, enum ws_log_level, const gchar *message, gpointer);
|
||||
static void funnel_statistics_retap_packets(funnel_ops_id_t *ops_id);
|
||||
static void funnel_statistics_copy_to_clipboard(GString *text);
|
||||
static const gchar *funnel_statistics_get_filter(funnel_ops_id_t *ops_id);
|
||||
|
@ -214,14 +216,11 @@ void FunnelStatistics::displayFilterTextChanged(const QString &filter)
|
|||
display_filter_ = filter.toUtf8();
|
||||
}
|
||||
|
||||
|
||||
/* The GTK+ code says "finish this." We shall follow its lead */
|
||||
// XXX Finish this.
|
||||
void funnel_statistics_logger(const gchar *,
|
||||
GLogLevelFlags,
|
||||
void funnel_statistics_logger(const gchar *log_domain,
|
||||
enum ws_log_level log_level,
|
||||
const gchar *message,
|
||||
gpointer) {
|
||||
fputs(message, stderr);
|
||||
ws_log(log_domain, log_level, "%s", message);
|
||||
}
|
||||
|
||||
void funnel_statistics_retap_packets(funnel_ops_id_t *ops_id) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* ws_log_domains.h
|
||||
/* ws_log_defs.h
|
||||
* log domain definitions
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
|
@ -11,6 +11,12 @@
|
|||
#ifndef __WS_LOG_DOMAINS_H__
|
||||
#define __WS_LOG_DOMAINS_H__
|
||||
|
||||
/*
|
||||
* Which log domain to use is a matter of policy. Any string is valid (names
|
||||
* using parenthesis should be avoided). There are no hard rules but using a
|
||||
* non-default pre-defined log domain is a good rule of thumb.
|
||||
*/
|
||||
|
||||
/* Null domain */
|
||||
#define LOG_DOMAIN_NONE "(notset)"
|
||||
/* Default domain */
|
||||
|
@ -27,6 +33,22 @@
|
|||
#define LOG_DOMAIN_WSUTIL "WSUtil"
|
||||
#define LOG_DOMAIN_QTUI "GUI"
|
||||
|
||||
/*
|
||||
* Descending order by priority needs to be maintained. Higher priorities have
|
||||
* lower values.
|
||||
*/
|
||||
enum ws_log_level {
|
||||
LOG_LEVEL_NONE, /* not user facing */
|
||||
LOG_LEVEL_ERROR, /* "error" is always fatal (aborts) */
|
||||
LOG_LEVEL_CRITICAL, /* always enabled, can be set to fatal */
|
||||
LOG_LEVEL_WARNING, /* can be set to fatal */
|
||||
LOG_LEVEL_MESSAGE, /* default level, doesn't show file/function name */
|
||||
LOG_LEVEL_INFO, /* chatty status but not debug */
|
||||
LOG_LEVEL_DEBUG, /* normal debugging level */
|
||||
LOG_LEVEL_NOISY, /* extra verbose debugging */
|
||||
_LOG_LEVEL_LAST
|
||||
};
|
||||
|
||||
#endif /* __WS_LOG_DOMAINS_H__ */
|
||||
|
||||
/*
|
|
@ -9,43 +9,19 @@
|
|||
#ifndef __WSLOG_H__
|
||||
#define __WSLOG_H__
|
||||
|
||||
#include <ws_log_defs.h>
|
||||
#include <ws_symbol_export.h>
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Descending order by priority needs to be maintained. Higher priorities have
|
||||
* lower values.
|
||||
*/
|
||||
enum ws_log_level {
|
||||
LOG_LEVEL_NONE, /* not user facing */
|
||||
LOG_LEVEL_ERROR, /* "error" is always fatal (aborts) */
|
||||
LOG_LEVEL_CRITICAL, /* always enabled, can be set to fatal */
|
||||
LOG_LEVEL_WARNING, /* can be set to fatal */
|
||||
LOG_LEVEL_MESSAGE, /* default level, doesn't show file/function name */
|
||||
LOG_LEVEL_INFO, /* chatty status but not debug */
|
||||
LOG_LEVEL_DEBUG, /* normal debugging level */
|
||||
LOG_LEVEL_NOISY, /* extra verbose debugging */
|
||||
_LOG_LEVEL_LAST
|
||||
};
|
||||
|
||||
/*
|
||||
* Which log domain to use is a matter of policy. Any string is valid (names
|
||||
* using parenthesis should be avoided). There are no hard rules but using a
|
||||
* non-default pre-defined log domain is a good rule of thumb.
|
||||
*/
|
||||
|
||||
#include <ws_log_domains.h>
|
||||
|
||||
#ifndef WS_LOG_DOMAIN
|
||||
#define WS_LOG_DOMAIN LOG_DOMAIN_DEFAULT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** Callback for registering a log writer. */
|
||||
typedef void (ws_log_writer_cb)(const char *domain, enum ws_log_level level,
|
||||
|
|
Loading…
Reference in New Issue