Tor
0.4.7.0-alpha-dev
app
config
quiet_level.c
Go to the documentation of this file.
1
/* Copyright (c) 2001 Matej Pfajfar.
2
* Copyright (c) 2001-2004, Roger Dingledine.
3
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4
* Copyright (c) 2007-2021, The Tor Project, Inc. */
5
/* See LICENSE for licensing information */
6
7
/**
8
* @file quiet_level.c
9
* @brief Code to handle default logging level (quiet/hush/normal).
10
**/
11
12
#include "orconfig.h"
13
#include "
lib/log/log.h
"
14
#include "
app/config/quiet_level.h
"
15
16
/** Decides our behavior when no logs are configured/before any logs have been
17
* configured. For QUIET_NONE, we log notice to stdout as normal. For
18
* QUIET_HUSH, we log warnings only. For QUIET_SILENT, we log nothing.
19
*/
20
quiet_level_t
quiet_level
= 0;
21
22
/** Add a default log (or not), depending on the value of <b>quiet</b>. */
23
void
24
add_default_log_for_quiet_level
(
quiet_level_t
quiet
)
25
{
26
switch
(
quiet
) {
27
case
QUIET_SILENT
:
28
/* --quiet: no initial logging */
29
return
;
30
case
QUIET_HUSH
:
31
/* --hush: log at warning or higher. */
32
add_default_log
(
LOG_WARN
);
33
break
;
34
case
QUIET_NONE
: FALLTHROUGH;
35
default
:
36
add_default_log
(
LOG_NOTICE
);
37
}
38
}
quiet
int quiet
Definition:
config.c:2442
add_default_log
void add_default_log(int min_severity)
Definition:
log.c:944
log.h
Headers for log.c.
LOG_NOTICE
#define LOG_NOTICE
Definition:
log.h:50
LOG_WARN
#define LOG_WARN
Definition:
log.h:53
quiet_level
quiet_level_t quiet_level
Definition:
quiet_level.c:20
add_default_log_for_quiet_level
void add_default_log_for_quiet_level(quiet_level_t quiet)
Definition:
quiet_level.c:24
quiet_level.h
Declare the quiet_level enumeration and global.
quiet_level_t
quiet_level_t
Definition:
quiet_level.h:16
QUIET_SILENT
@ QUIET_SILENT
Definition:
quiet_level.h:22
QUIET_NONE
@ QUIET_NONE
Definition:
quiet_level.h:18
QUIET_HUSH
@ QUIET_HUSH
Definition:
quiet_level.h:20
Generated by
1.9.1