xref: /aosp_15_r20/external/pytorch/torch/distributed/elastic/events/handlers.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/usr/bin/env python3
2
3# Copyright (c) Facebook, Inc. and its affiliates.
4# All rights reserved.
5#
6# This source code is licensed under the BSD-style license found in the
7# LICENSE file in the root directory of this source tree.
8
9import logging
10from typing import Dict
11
12
13_log_handlers: Dict[str, logging.Handler] = {
14    "console": logging.StreamHandler(),
15    "dynamic_rendezvous": logging.NullHandler(),
16    "null": logging.NullHandler(),
17}
18
19
20def get_logging_handler(destination: str = "null") -> logging.Handler:
21    global _log_handlers
22    return _log_handlers[destination]
23