Go to the documentation of this file.00001
00002
00003 import logging
00004 import nasa_common_logging
00005 import traceback
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 nasa_common_logging.logging_utils.configure_common_logging()
00016
00017 logger = logging.getLogger(__name__)
00018
00019 logger.info('hello world')
00020 logger.log(nasa_common_logging.log_level['error'], 'hey world!')
00021
00022 try:
00023 a = 1. / 0.
00024 except ZeroDivisionError as e:
00025 trace = traceback.format_exc()
00026 logger.error(str(trace))
00027
00028 sublog = logger.getChild('sub')
00029 sublog.log(nasa_common_logging.log_level['CRITICAL'], 'for real, world, where you at?!')
00030
00031 my_custom_logging_config = nasa_common_logging.logging_utils.get_common_logging_configuration()
00032 my_custom_logging_config['handlers']['console']['formatter'] = 'brief'
00033 nasa_common_logging.logging_utils.configure_custom_logging(my_custom_logging_config)
00034 logger.log(nasa_common_logging.log_level['warn'], 'custom log format')