Open ant0nsc opened 2 years ago
I agree!
On a related note, I think would be great to use more user-friendly log format e.g. logging.basicConfig(format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', filemode='w')
@usuyama , is your ask mostly about the pathname and linenumber? Also, what's your entrypoint into the hi-ml code?
@fepegar @ozan-oktay we should keep this in mind for the multimodal subfolder as well.
@usuyama thanks for suggesting that format. I think it's quite nice. Here's a tiny test (with a little variation):
import logging
logger = logging.getLogger(__name__)
formatter = logging.Formatter('%(asctime)s - %(pathname)s:%(lineno)d - %(levelname)s - %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
logger.debug('Hey!')
logger.info('Hey!')
logger.warning('Hey!')
logger.error('Hey!')
logger.critical('Hey!')
2022-11-28 16:02:05,690 - l.py:8 - WARNING - Hey!
Which is quite nicely syntax-highlighted in VS Code:
At present, a lot of the code in
hi-ml
writes out information via a plain call tologging.info
. Instead, this should use a package-level logger that can be configured by the user.Thanks for raising that @Shruthi42