Tor  0.4.7.0-alpha-dev
log_sys.c
Go to the documentation of this file.
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 subsys_logging_initialize(void)
17 {
18  init_logging(0);
19  return 0;
20 }
21 
22 static void
23 subsys_logging_shutdown(void)
24 {
25  logs_free_all();
26  escaped(NULL);
27 }
28 
29 const subsys_fns_t sys_logging = {
30  .name = "log",
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 };
const char * escaped(const char *s)
Definition: escape.c:126
Header for escape.c.
void init_logging(int disable_startup_queue)
Definition: log.c:911
void logs_free_all(void)
Definition: log.c:745
Headers for log.c.
Declare subsystem object for the logging module.
const char * name
Definition: subsys.h:43
Types used to declare a subsystem.
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211