LCOV - code coverage report
Current view: top level - app/config - quiet_level.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 7 7 100.0 %
Date: 2021-11-24 03:28:48 Functions: 1 1 100.0 %

          Line data    Source code
       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         248 : add_default_log_for_quiet_level(quiet_level_t quiet)
      25             : {
      26         248 :   switch (quiet) {
      27             :     case QUIET_SILENT:
      28             :       /* --quiet: no initial logging */
      29             :       return;
      30          34 :     case QUIET_HUSH:
      31             :     /* --hush: log at warning or higher. */
      32          34 :       add_default_log(LOG_WARN);
      33          34 :       break;
      34          89 :     case QUIET_NONE: FALLTHROUGH;
      35             :     default:
      36          89 :       add_default_log(LOG_NOTICE);
      37             :   }
      38             : }

Generated by: LCOV version 1.14