MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / get_logger

Function get_logger

utils.py:84–99  ·  view source on GitHub ↗
(name, save_path=None, level='INFO')

Source from the content-addressed store, hash-verified

82
83
84def get_logger(name, save_path=None, level='INFO'):
85 logger = logging.getLogger(name)
86 logger.setLevel(getattr(logging, level))
87
88 log_format = logging.Formatter('[%(asctime)s %(levelname)s] %(message)s')
89 streamHandler = logging.StreamHandler()
90 streamHandler.setFormatter(log_format)
91 logger.addHandler(streamHandler)
92
93 if not save_path is None:
94 os.makedirs(save_path, exist_ok=True)
95 fileHandler = logging.FileHandler(os.path.join(save_path, 'log.txt'))
96 fileHandler.setFormatter(log_format)
97 logger.addHandler(fileHandler)
98
99 return logger
100
101
102def count_parameters(model):

Callers 13

main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90
main_workerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected