MCPcopy Create free account
hub / github.com/InternScience/InternAgent / setup_default_logging

Function setup_default_logging

tasks/AutoPower/code/src/utils.py:216–235  ·  view source on GitHub ↗
(save_path, flag_multigpus=False, l_level='INFO')

Source from the content-addressed store, hash-verified

214
215
216def setup_default_logging(save_path, flag_multigpus=False, l_level='INFO'):
217
218 if flag_multigpus:
219 rank = dist.get_rank()
220 if rank != 0:
221 return
222
223 tmp_timestr = time_str(fmt='%Y_%m_%d_%H_%M_%S')
224 logger.add(
225 os.path.join(save_path, f'{tmp_timestr}.log'),
226 # level='DEBUG',
227 level=l_level,
228 # format='{time:YYYY-MM-DD HH:mm:s} {file}[{line}] {level}: {message}',
229 format='{level}|{time:YYYY-MM-DD HH:mm:ss}: {message}',
230 # retention='30 days',
231 # rotation='30mb',
232 enqueue=True,
233 encoding='utf-8',
234 )
235 return tmp_timestr
236
237
238

Callers

nothing calls this directly

Calls 3

time_strFunction · 0.85
get_rankMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected