handlers.py 556 B

123456789101112131415161718192021
  1. #!/usr/bin/env python3
  2. # Copyright (c) Facebook, Inc. and its affiliates.
  3. # All rights reserved.
  4. #
  5. # This source code is licensed under the BSD-style license found in the
  6. # LICENSE file in the root directory of this source tree.
  7. import logging
  8. _log_handlers: dict[str, logging.Handler] = {
  9. "console": logging.StreamHandler(),
  10. "dynamic_rendezvous": logging.NullHandler(),
  11. "null": logging.NullHandler(),
  12. }
  13. def get_logging_handler(destination: str = "null") -> logging.Handler:
  14. global _log_handlers
  15. return _log_handlers[destination]