Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bittensor/utils/btlogging/loggingmachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import argparse
import atexit
import copy
import logging as stdlogging
import multiprocessing as mp
import os
Expand Down Expand Up @@ -182,7 +181,8 @@ def _extract_logging_config(self, config: "Config") -> dict:
Returns:
(dict): btlogging's config from Bittensor config or Bittensor config.
"""
if hasattr(config, "logging"):
# This is to handle nature of DefaultMunch
if getattr(config, "logging", None):
return config.logging
else:
return config
Expand Down Expand Up @@ -213,14 +213,14 @@ def set_config(self, config: "Config"):
Args:
config (bittensor.core.config.Config): Bittensor config instance.
"""
self._config = config
if config.logging_dir and config.record_log:
self._config = self._extract_logging_config(config)
if self._config.logging_dir and self._config.record_log:
expanded_dir = os.path.expanduser(config.logging_dir)
logfile = os.path.abspath(os.path.join(expanded_dir, DEFAULT_LOG_FILE_NAME))
self._enable_file_logging(logfile)
if config.trace:
if self._config.trace:
self.enable_trace()
elif config.debug:
elif self._config.debug:
self.enable_debug()

def _create_and_start_listener(self, handlers):
Expand Down Expand Up @@ -618,7 +618,7 @@ def __call__(
logging_dir: str = None,
):
if config is not None:
cfg = copy.deepcopy(config)
cfg = self._extract_logging_config(config)
if debug is not None:
cfg.debug = debug
elif trace is not None:
Expand Down