MCPcopy
hub / github.com/Vchitect/Latte / create_logger

Function create_logger

utils.py:148–165  ·  view source on GitHub ↗

Create a logger that writes to a log file and stdout.

(logging_dir)

Source from the content-addressed store, hash-verified

146#################################################################################
147
148def create_logger(logging_dir):
149 """
150 Create a logger that writes to a log file and stdout.
151 """
152 if dist.get_rank() == 0: # real logger
153 logging.basicConfig(
154 level=logging.INFO,
155 # format='[\033[34m%(asctime)s\033[0m] %(message)s',
156 format='[%(asctime)s] %(message)s',
157 datefmt='%Y-%m-%d %H:%M:%S',
158 handlers=[logging.StreamHandler(), logging.FileHandler(f"{logging_dir}/log.txt")]
159 )
160 logger = logging.getLogger(__name__)
161
162 else: # dummy logger (does nothing)
163 logger = logging.getLogger(__name__)
164 logger.addHandler(logging.NullHandler())
165 return logger
166
167
168def create_tensorboard(tensorboard_dir):

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected