code: def log_level(io_handler, level=None, name=None):
          
          # Get the logger
          logger = logging.getLogger(name)
  
          # Normalize the name
          if not name:
              name = "Root"
  
          if not level:
              # Level not given: print the logger level
              io_handler.write_line(
                  "{0} log level: {1} (real: {2})",
                  name,
                  logging.getLevelName(logger.getEffectiveLevel()),
                  logging.getLevelName(logger.level),
              )
          else:
              # Set the logger level
              try:
                  logger.setLevel(level.upper())
                  io_handler.write_line("New level for {0}: {1}", name, level)
              except ValueError:
                  io_handler.write_line("Invalid log level: {0}", level)
docs: Prints/Changes log level