mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Extract the log_domain_t type to a lower-level header
This way, both err and log may depend on it.
This commit is contained in:
parent
f682de609b
commit
5fb070a14d
7 changed files with 34 additions and 8 deletions
|
@ -3,5 +3,6 @@
|
|||
noinst_HEADERS += \
|
||||
src/lib/defs/dh_sizes.h \
|
||||
src/lib/defs/digest_sizes.h \
|
||||
src/lib/defs/logging_types.h \
|
||||
src/lib/defs/time.h \
|
||||
src/lib/defs/x25519_sizes.h
|
||||
|
|
23
src/lib/defs/logging_types.h
Normal file
23
src/lib/defs/logging_types.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* Copyright (c) 2001, Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2019, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/**
|
||||
* \file logging_types.h
|
||||
*
|
||||
* \brief Global definition for types used by logging systems.
|
||||
**/
|
||||
|
||||
#ifndef TOR_LOGGING_TYPES_H
|
||||
#define TOR_LOGGING_TYPES_H
|
||||
|
||||
/* We define this here so that it can be used both by backtrace.h and
|
||||
* log.h.
|
||||
*/
|
||||
|
||||
/** Mask of zero or more log domains, OR'd together. */
|
||||
typedef uint64_t log_domain_mask_t;
|
||||
|
||||
#endif
|
|
@ -1,5 +1,6 @@
|
|||
orconfig.h
|
||||
lib/cc/*.h
|
||||
lib/defs/*.h
|
||||
lib/err/*.h
|
||||
lib/subsys/*.h
|
||||
lib/version/*.h
|
|
@ -115,7 +115,7 @@ clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx)
|
|||
* that with a backtrace log. Send messages via the tor_log function at
|
||||
* logger". */
|
||||
void
|
||||
log_backtrace_impl(int severity, uint64_t domain, const char *msg,
|
||||
log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg,
|
||||
tor_log_fn logger)
|
||||
{
|
||||
size_t depth;
|
||||
|
@ -240,7 +240,7 @@ remove_bt_handler(void)
|
|||
|
||||
#ifdef NO_BACKTRACE_IMPL
|
||||
void
|
||||
log_backtrace_impl(int severity, uint64_t domain, const char *msg,
|
||||
log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg,
|
||||
tor_log_fn logger)
|
||||
{
|
||||
logger(severity, domain, "%s. (Stack trace not available)", msg);
|
||||
|
|
|
@ -13,11 +13,13 @@
|
|||
#include "orconfig.h"
|
||||
#include "lib/cc/compat_compiler.h"
|
||||
#include "lib/cc/torint.h"
|
||||
#include "lib/defs/logging_types.h"
|
||||
|
||||
typedef void (*tor_log_fn)(int, uint64_t, const char *fmt, ...)
|
||||
typedef void (*tor_log_fn)(int, log_domain_mask_t, const char *fmt, ...)
|
||||
CHECK_PRINTF(3,4);
|
||||
|
||||
void log_backtrace_impl(int severity, uint64_t domain, const char *msg,
|
||||
void log_backtrace_impl(int severity, log_domain_mask_t domain,
|
||||
const char *msg,
|
||||
tor_log_fn logger);
|
||||
int configure_backtrace_handler(const char *tor_version);
|
||||
void clean_up_backtrace_handler(void);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
orconfig.h
|
||||
|
||||
lib/cc/*.h
|
||||
lib/defs/*.h
|
||||
lib/smartlist_core/*.h
|
||||
lib/err/*.h
|
||||
lib/fdio/*.h
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <stdarg.h>
|
||||
#include "lib/cc/torint.h"
|
||||
#include "lib/cc/compat_compiler.h"
|
||||
#include "lib/defs/logging_types.h"
|
||||
#include "lib/testsupport/testsupport.h"
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
|
@ -132,9 +133,6 @@
|
|||
* would. Used as a flag, not a log domain. */
|
||||
#define LD_NOFUNCNAME (UINT64_C(1)<<63)
|
||||
|
||||
/** Mask of zero or more log domains, OR'd together. */
|
||||
typedef uint64_t log_domain_mask_t;
|
||||
|
||||
/** Configures which severities are logged for each logging domain for a given
|
||||
* log target. */
|
||||
typedef struct log_severity_list_t {
|
||||
|
|
Loading…
Add table
Reference in a new issue