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