handlers.py 580 B

12345678910111213141516171819202122
  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. from typing import Dict
  9. _log_handlers: Dict[str, logging.Handler] = {
  10. "console": logging.StreamHandler(),
  11. "dynamic_rendezvous": logging.NullHandler(),
  12. "null": logging.NullHandler(),
  13. }
  14. def get_logging_handler(destination: str = "null") -> logging.Handler:
  15. global _log_handlers
  16. return _log_handlers[destination]