X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=logging_utils.py;h=819e3d3ee780a78cc903a890eba03e533b608870;hb=ed8fa2b10b0177b15b7423263bdd390efde2f0c8;hp=eec07984b282b9a0ef1e4adea7ab6951a0abc71e;hpb=eb9e6df32ed696158bf34dba6464277b648f5c74;p=python_utils.git diff --git a/logging_utils.py b/logging_utils.py index eec0798..819e3d3 100644 --- a/logging_utils.py +++ b/logging_utils.py @@ -76,7 +76,7 @@ cfg.add_argument( cfg.add_argument( '--logging_filename_count', type=int, - default=2, + default=7, metavar='COUNT', help='The number of logging_filename copies to keep before deleting.' ) @@ -92,6 +92,12 @@ cfg.add_argument( default=False, help='Should we prepend pid/tid data to all log messages?' ) +cfg.add_argument( + '--logging_debug_modules', + action=argparse_utils.ActionNoYes, + default=False, + help='Should we prepend module/function data to all log messages?' +) cfg.add_argument( '--logging_info_is_print', action=argparse_utils.ActionNoYes, @@ -379,6 +385,8 @@ def initialize_logging(logger=None) -> logging.Logger: fmt = config.config['logging_format'] if config.config['logging_debug_threads']: fmt = f'%(process)d.%(thread)d|{fmt}' + if config.config['logging_debug_modules']: + fmt = f'%(filename)s:%(funcName)s:%(lineno)s|{fmt}' if config.config['logging_syslog']: if sys.platform not in ('win32', 'cygwin'):