Line data Source code
1 : /* Copyright (c) 2018-2021, The Tor Project, Inc. */ 2 : /* See LICENSE for licensing information */ 3 : 4 : /** 5 : * \file log_sys.c 6 : * \brief Setup and tear down the logging module. 7 : **/ 8 : 9 : #include "orconfig.h" 10 : #include "lib/subsys/subsys.h" 11 : #include "lib/log/escape.h" 12 : #include "lib/log/log.h" 13 : #include "lib/log/log_sys.h" 14 : 15 : static int 16 5553 : subsys_logging_initialize(void) 17 : { 18 5553 : init_logging(0); 19 5553 : return 0; 20 : } 21 : 22 : static void 23 235 : subsys_logging_shutdown(void) 24 : { 25 235 : logs_free_all(); 26 235 : escaped(NULL); 27 235 : } 28 : 29 : const subsys_fns_t sys_logging = { 30 : .name = "log", 31 : SUBSYS_DECLARE_LOCATION(), 32 : .supported = true, 33 : /* Logging depends on threads, approx time, raw logging, and security. 34 : * Most other lib modules depend on logging. */ 35 : .level = -90, 36 : .initialize = subsys_logging_initialize, 37 : .shutdown = subsys_logging_shutdown, 38 : };