Closed m9brady closed 4 years ago
Basically replaces print statements with logging messages that are off by default.
print
logging
>>> from pySnowRadar import SnowRadar >>> x = SnowRadar('./path/to/data', l_case='full') >>> x.as_dict() { fname: 'data', ... }
No log messages on SnowRadar object init ☝️
SnowRadar
It is up to the user to add a handler in order to see log messages in stdout/stderr, which can be accomplished as follows:
>>> import logging >>> logger = logging.getLogger('pySnowRadar') >>> sh = logging.StreamHandler() >>> fmt = logging.Formatter('%(asctime)s | %(name)s | %(message)s', '%Y-%m-%d %H:%M:%S') >>> sh.addFormatter(fmt) >>> logger.addHandler(sh) >>> logger.setLevel(logging.DEBUG) # SnowRadar object init log message is debug-level >>> x = SnowRadar('./path/to/data', l_case='full') 2077-01-01 12:15:00 | pySnowRadar.snowradar | Loading: data (full)
Basically replaces
print
statements withlogging
messages that are off by default.No log messages on
SnowRadar
object init ☝️It is up to the user to add a handler in order to see log messages in stdout/stderr, which can be accomplished as follows: