code: def fileprint(filename, category, level=logging.DEBUG, maxBytes=1024*10124*100,
               backupCount=0):
      
      path = os.path.join(CFG.filedir, category, filename)
  
      # Initialize filer
      filer = logging.getLogger(filename)
      frt = logging.Formatter('%(message)s')
  
      hdr = RotatingFileHandler(path, 'a', maxBytes, backupCount, 'utf-8')
      hdr.setFormatter(frt)
      hdr._name = '##_rfh_##'
      already_in = False
      for _hdr in filer.handlers:
          if _hdr._name == '##_rfh_##':
              already_in = True
              break
      if not already_in:
          filer.addHandler(hdr)
  
      hdr = logging.StreamHandler(sys.stdout)
      hdr.setFormatter(frt)
      hdr._name = '##_sh_##'
      already_in = False
      for _hdr in filer.handlers:
          if _hdr._name == '##_sh_##':
              already_in = True
      if not already_in:
          filer.addHandler(hdr)
  
      filer.setLevel(level)
      def _wraper(*args):
          if not args:
              return
          encoding = 'utf8' if os.name == 'posix' else 'gbk'
          args = [_cu(a, encoding) for a in args]
          filer.info(' '.join(args))
      return _wraper, filer
docs: Print files by file size.
  
          filename
            string, file name
          category
            string, category path of logs file in log directory
          level
            enumerated type of logging module, restrict whether logs to be printed or not
          maxBytes
            int, max limit of file size
          backupCount
            int, allowed numbers of file copys