Tor 0.4.9.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-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"
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>. */
23void
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}
int quiet
Definition: config.c:2470
void add_default_log(int min_severity)
Definition: log.c:946
Headers for log.c.
#define LOG_NOTICE
Definition: log.h:50
#define LOG_WARN
Definition: log.h:53
quiet_level_t quiet_level
Definition: quiet_level.c:20
void add_default_log_for_quiet_level(quiet_level_t quiet)
Definition: quiet_level.c:24
Declare the quiet_level enumeration and global.
quiet_level_t
Definition: quiet_level.h:16
@ QUIET_SILENT
Definition: quiet_level.h:22
@ QUIET_NONE
Definition: quiet_level.h:18
@ QUIET_HUSH
Definition: quiet_level.h:20