log_sys.c 772 B

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