Loading src/app/config/quiet_level.c 0 → 100644 +33 −0 Original line number Diff line number Diff line /* 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 */ #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: /* fall through */ default: add_default_log(LOG_NOTICE); } } src/app/config/quiet_level.h +2 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,6 @@ typedef enum { /** How quietly should Tor log at startup? */ extern quiet_level_t quiet_level; void add_default_log_for_quiet_level(quiet_level_t quiet); #endif /* !defined(QUIET_LEVEL_H) */ src/app/main/main.c +1 −22 Original line number Diff line number Diff line Loading @@ -109,16 +109,6 @@ static void dumpmemusage(int severity); static void dumpstats(int severity); /* log stats */ static void process_signal(int sig); /********* START VARIABLES **********/ /** 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; /********* END VARIABLES ************/ /** Called when we get a SIGHUP: reload configuration files and keys, * retry all connections, and so on. */ static int Loading Loading @@ -558,18 +548,7 @@ tor_init(int argc, char *argv[]) } /* give it somewhere to log to initially */ switch (quiet) { case QUIET_SILENT: /* --quiet: no initial logging */ break; case QUIET_HUSH: /* --hush: log at warning or higher. */ add_default_log(LOG_WARN); break; case QUIET_NONE: /* fall through */ default: add_default_log(LOG_NOTICE); } add_default_log_for_quiet_level(quiet); quiet_level = quiet; { Loading src/core/include.am +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ endif # ADD_C_FILE: INSERT SOURCES HERE. LIBTOR_APP_A_SOURCES = \ src/app/config/config.c \ src/app/config/quiet_level.c \ src/app/config/statefile.c \ src/app/main/main.c \ src/app/main/shutdown.c \ Loading Loading
src/app/config/quiet_level.c 0 → 100644 +33 −0 Original line number Diff line number Diff line /* 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 */ #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: /* fall through */ default: add_default_log(LOG_NOTICE); } }
src/app/config/quiet_level.h +2 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,6 @@ typedef enum { /** How quietly should Tor log at startup? */ extern quiet_level_t quiet_level; void add_default_log_for_quiet_level(quiet_level_t quiet); #endif /* !defined(QUIET_LEVEL_H) */
src/app/main/main.c +1 −22 Original line number Diff line number Diff line Loading @@ -109,16 +109,6 @@ static void dumpmemusage(int severity); static void dumpstats(int severity); /* log stats */ static void process_signal(int sig); /********* START VARIABLES **********/ /** 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; /********* END VARIABLES ************/ /** Called when we get a SIGHUP: reload configuration files and keys, * retry all connections, and so on. */ static int Loading Loading @@ -558,18 +548,7 @@ tor_init(int argc, char *argv[]) } /* give it somewhere to log to initially */ switch (quiet) { case QUIET_SILENT: /* --quiet: no initial logging */ break; case QUIET_HUSH: /* --hush: log at warning or higher. */ add_default_log(LOG_WARN); break; case QUIET_NONE: /* fall through */ default: add_default_log(LOG_NOTICE); } add_default_log_for_quiet_level(quiet); quiet_level = quiet; { Loading
src/core/include.am +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ endif # ADD_C_FILE: INSERT SOURCES HERE. LIBTOR_APP_A_SOURCES = \ src/app/config/config.c \ src/app/config/quiet_level.c \ src/app/config/statefile.c \ src/app/main/main.c \ src/app/main/shutdown.c \ Loading