DigitalMag

custom logging level

Jan 25th, 2021
550
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import logging
  2. DEBUG_LEVELV_NUM = 31
  3. logging.addLevelName(DEBUG_LEVELV_NUM, "[DEBUGV]")
  4. logging.basicConfig(level=logging.INFO)
  5.  
  6. logger = logging.getLogger(__name__)
  7. logger.setLevel(logging.INFO)
  8.  
  9.  
  10. def main():
  11.     logger.log(DEBUG_LEVELV_NUM, '---123---')
  12.     logger.info('123')
  13.  
  14. if __name__ == '__main__':
  15.     main()
RAW Paste Data