Python logging.VERBOSE Examples
The following are 8
code examples of logging.VERBOSE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
logging
, or try the search function
.
Example #1
Source File: cli.py From cot with MIT License | 6 votes |
def adjust_verbosity(self, delta): """Set the logging verbosity relative to the COT default. Wrapper for :meth:`set_verbosity`, to be used when you have a delta (number of steps to offset more or less verbose) rather than an actual logging level in mind. Args: delta (int): Shift in verbosity level. 0 = default verbosity; positive implies more verbose; negative implies less verbose. """ verbosity_levels = [ logging.CRITICAL, logging.ERROR, logging.WARNING, # quieter logging.NOTICE, # default logging.INFO, logging.VERBOSE, # more verbose logging.DEBUG, logging.SPAM, # really noisy ] verbosity = verbosity_levels.index(logging.NOTICE) + delta if verbosity < 0: verbosity = 0 elif verbosity >= len(verbosity_levels): verbosity = len(verbosity_levels) - 1 level = verbosity_levels[verbosity] self.set_verbosity(level)
Example #2
Source File: cot_testcase.py From cot with MIT License | 6 votes |
def assertNoLogsOver(self, max_level, info=''): # noqa: N802 """Fail if any logs are logged higher than the given level. Args: max_level (int): Highest logging level to permit. info (str): Optional string to prepend to any failure messages. Raises: AssertionError: if any messages higher than max_level were seen """ for level in (logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.VERBOSE, logging.DEBUG): if level <= max_level: return matches = self.logs(levelno=level) if matches: self.testcase.fail( "{info}Found {len} unexpected {lvl} message(s):\n\n{msgs}" .format(info=info, len=len(matches), lvl=logging.getLevelName(level), msgs="\n\n".join([r['msg'] % r['args'] for r in matches])))
Example #3
Source File: dashproxy.py From dash-proxy with MIT License | 6 votes |
def handle_mpd(self, mpd): original_mpd = copy.deepcopy(mpd) periods = mpd.findall('mpd:Period', ns) logger.log(logging.INFO, 'mpd=%s' % (periods,)) logger.log(logging.VERBOSE, 'Found %d periods choosing the 1st one' % (len(periods),)) period = periods[0] for as_idx, adaptation_set in enumerate( period.findall('mpd:AdaptationSet', ns) ): for rep_idx, representation in enumerate( adaptation_set.findall('mpd:Representation', ns) ): self.verbose('Found representation with id %s' % (representation.attrib.get('id', 'UKN'),)) rep_addr = RepAddr(0, as_idx, rep_idx) self.ensure_downloader(mpd, rep_addr) self.write_output_mpd(original_mpd) minimum_update_period = mpd.attrib.get('minimumUpdatePeriod', '') if minimum_update_period: # TODO parse minimum_update_period self.refresh_mpd(after=10) else: self.info('VOD MPD. Nothing more to do. Stopping...')
Example #4
Source File: log.py From eyeD3 with GNU General Public License v3.0 | 5 votes |
def verbose(self, msg, *args, **kwargs): """Log \a msg at 'verbose' level, debug < verbose < info""" self.log(logging.VERBOSE, msg, *args, **kwargs)
Example #5
Source File: settings.py From fanci with GNU General Public License v3.0 | 5 votes |
def configure_logger(): global LOGGER_CONFIGURED, log if not LOGGER_CONFIGURED: logging.Logger.manager.loggerDict.clear() logging.VERBOSE = 5 logging.addLevelName(logging.VERBOSE, 'VERBOSE') logging.Logger.verbose = lambda inst, msg, *args, **kwargs: inst.log(logging.VERBOSE, msg, *args, **kwargs) logging.verbose = lambda msg, *args, **kwargs: logging.log(logging.VERBOSE, msg, *args, **kwargs) log = logging.getLogger('log') log.setLevel(LOG_LVL) log_formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s') if LOG_TO_FILE: file_handler = logging.FileHandler(datetime.now().strftime(LOG_ROOT + 'learning_%Y_%m_%d_%H_%M_.log')) file_handler.setLevel(logging.INFO) file_handler.setFormatter(log_formatter) log.addHandler(file_handler) console_handler = logging.StreamHandler() console_handler.setFormatter(log_formatter) log.addHandler(console_handler) if PRINT_TO_LOG_CONVERT: builtins.print = log_print LOGGER_CONFIGURED = True
Example #6
Source File: cli.py From cot with MIT License | 5 votes |
def __init__(self, verbosity=logging.INFO): """Create formatter for COT log output with the given verbosity.""" format_string = "%(log_color)s" datefmt = None # Start with log level string format_items = ["%(levelname)-7s"] if verbosity <= logging.DEBUG: # Provide timestamps format_items.append("%(asctime)s.%(msecs)d") datefmt = "%H:%M:%S" if verbosity <= logging.INFO: # Provide module name # Longest module names at present: # data_validation (15) # edit_properties (15) # install_helpers (15) format_items.append("%(module)-15s") if verbosity <= logging.DEBUG: # Provide line number, up to 4 digits format_items.append("%(lineno)4d") if verbosity <= logging.VERBOSE: # Provide function name # Pylint is configured to only allow func names up to 31 characters format_items.append("%(funcName)31s()") format_string += " : ".join(format_items) format_string += " :%(reset)s %(message)s" super(CLILoggingFormatter, self).__init__(format_string, datefmt=datefmt, reset=False, log_colors=self.LOG_COLORS)
Example #7
Source File: dashproxy.py From dash-proxy with MIT License | 5 votes |
def verbose(self, msg): self.logger.log(logging.VERBOSE, msg)
Example #8
Source File: dashproxy.py From dash-proxy with MIT License | 5 votes |
def run(args): logger.setLevel(logging.VERBOSE if args.v else logging.INFO) proxy = DashProxy(mpd=args.mpd, output_dir=args.o, download=args.d, save_mpds=args.save_individual_mpds) return proxy.run()