Tor  0.4.5.0-alpha-dev
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-2020, 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  */
21 
22 /** Add a default log (or not), depending on the value of <b>quiet</b>. */
23 void
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. */
33  break;
34  case QUIET_NONE: FALLTHROUGH;
35  default:
37  }
38 }
LOG_NOTICE
#define LOG_NOTICE
Definition: log.h:50
QUIET_SILENT
@ QUIET_SILENT
Definition: quiet_level.h:22
quiet
int quiet
Definition: config.c:2449
quiet_level.h
Declare the quiet_level enumeration and global.
add_default_log_for_quiet_level
void add_default_log_for_quiet_level(quiet_level_t quiet)
Definition: quiet_level.c:24
log.h
Headers for log.c.
LOG_WARN
#define LOG_WARN
Definition: log.h:53
QUIET_NONE
@ QUIET_NONE
Definition: quiet_level.h:18
add_default_log
void add_default_log(int min_severity)
Definition: log.c:983
QUIET_HUSH
@ QUIET_HUSH
Definition: quiet_level.h:20
quiet_level_t
quiet_level_t
Definition: quiet_level.h:16
quiet_level
quiet_level_t quiet_level
Definition: quiet_level.c:20