예제 #1
0
def SetupCommonLoggingFormat(verbose=True):
    """Sets up common logging format for the logging module."""
    logging_format = '%(asctime)s - %(filename)s - %(levelname)-8s: %(message)s'
    date_format = '%Y/%m/%d %H:%M:%S'
    logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO,
                        format=logging_format,
                        datefmt=date_format)
예제 #2
0
def main():
    """Main function wrapper"""
    try:
        (options, _) = parse_args(sys.argv[1:])

        # Set Log format
        log_format = '%(asctime)s %(levelname)-6s | %(name)-25s'
        date_format = '%Y-%m-%d %H:%M:%S'
        if options.debug:
            log_format += ' | %(filename)s:%(lineno)4d:%(funcName)-18s'
            loglevel = logging.DEBUG
        else:
            loglevel = logging.INFO
        log_format += ' | %(message)s'

        logging.basicConfig(level=loglevel,
                            format=log_format,
                            datefmt=date_format)

        # Create a ChargenTest object
        utest = ChargenTest(options.port, options.time, options.cr50)
        utest.run()  # Run

    except KeyboardInterrupt:
        sys.exit(0)

    except ChargenTestError as e:
        logging.error(str(e))
        sys.exit(1)
예제 #3
0
def SetupLogging(logdir):
    logging.basicConfig(
        level=logging.DEBUG,
        format='%(asctime)s:%(name)s:%(levelname)-8s %(message)s',
        datefmt='%Y-%m-%d %H:%M',
        filename=os.path.join(logdir, LOGFILE),
        filemode='w')
    rotate = logging_handlers.RotatingFileHandler(os.path.join(
        logdir, LOGFILE),
                                                  maxBytes=LOGFILE_SIZE_BYTES,
                                                  backupCount=LOGFILE_COUNT)
    logging.getLogger().addHandler(rotate)
예제 #4
0
def SetupLogging(logdir):
  logging.basicConfig(
      level=logging.DEBUG,
      format='%(asctime)s:%(name)s:%(levelname)-8s %(message)s',
      datefmt='%Y-%m-%d %H:%M',
      filename=os.path.join(logdir, LOGFILE),
      filemode='w'
  )
  rotate = logging_handlers.RotatingFileHandler(
      os.path.join(logdir, LOGFILE), maxBytes=LOGFILE_SIZE_BYTES,
      backupCount=LOGFILE_COUNT)
  logging.getLogger().addHandler(rotate)
예제 #5
0
def main(argv):
    """Update cr50 using gsctool or cr50-rescue."""
    opts = parse_args(argv)

    loglevel = logging.INFO
    log_format = '%(asctime)s - %(levelname)7s'
    if opts.debug:
        loglevel = logging.DEBUG
        log_format += ' - %(lineno)3d:%(funcName)-15s'
    log_format += ' - %(message)s'
    logging.basicConfig(level=loglevel, format=log_format)

    image = Cr50Image(RELEASE_PATHS.get(opts.release, opts.image),
                      opts.artifacts_dir)
    flash_cr50 = get_updater(opts)

    logging.info('Using %s to update to %s', flash_cr50,
                 image.get_original_basename())
    flash_cr50.update(image)
예제 #6
0
from chromite.cbuildbot import constants
from chromite.lib import commandline
from chromite.lib import cros_build_lib
from chromite.lib import cros_logging as logging
from chromite.lib import osutils
from chromite.lib import parallel

arch = None
board = None
compiler = None
default_board = None
family = None
in_chroot = True

logging.basicConfig(format='%(message)s')
kwargs = {
    'print_cmd': False,
    'error_code_ok': True,
    'debug_level': logging.getLogger().getEffectiveLevel()
}

outdir = ''

# If you have multiple boards connected on different servo ports, put lines
# like 'SERVO_PORT{"peach_pit"} = 7777' in your ~/.crosfwrc
SERVO_PORT = {}

smdk = None
src_root = os.path.join(constants.SOURCE_ROOT, 'src')
in_chroot = cros_build_lib.IsInsideChroot()
예제 #7
0
def SetupCommonLoggingFormat(verbose=True):
  """Sets up common logging format for the logging module."""
  logging_format = '%(asctime)s - %(filename)s - %(levelname)-8s: %(message)s'
  date_format = '%Y/%m/%d %H:%M:%S'
  logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO,
                      format=logging_format, datefmt=date_format)
예제 #8
0
from chromite.cbuildbot import constants
from chromite.lib import commandline
from chromite.lib import cros_build_lib
from chromite.lib import cros_logging as logging
from chromite.lib import osutils
from chromite.lib import parallel


arch = None
board = None
compiler = None
default_board = None
family = None
in_chroot = True

logging.basicConfig(format='%(message)s')
kwargs = {'print_cmd': False, 'error_code_ok': True,
          'debug_level': logging.getLogger().getEffectiveLevel()}

outdir = ''

 # If you have multiple boards connected on different servo ports, put lines
# like 'SERVO_PORT{"peach_pit"} = 7777' in your ~/.crosfwrc
SERVO_PORT = {}

smdk = None
src_root = os.path.join(constants.SOURCE_ROOT, 'src')
in_chroot = cros_build_lib.IsInsideChroot()

uboard = ''