def setup_logging(args):
    logging_path = get_logfile_path()
    peachy_logger = logging.getLogger('peachy')
    logfile = os.path.join(logging_path, 'peachyinstaller.log')
    logging_format = '%(levelname)s: %(asctime)s %(module)s - %(message)s'
    logging_level = getattr(logging, args.loglevel.upper(), 'INFO')
    if (not isinstance(logging_level, int)):
        raise ValueError(('Invalid log level: %s' % args.loglevel))
    if True:
        peachy_logger = logging.getLogger('peachy')
        peachy_logger.propagate = False
        logFormatter = logging.Formatter(logging_format)
        fileHandler = logging.FileHandler(logfile)
        consoleHandler = logging.StreamHandler()
        fileHandler.setFormatter(logFormatter)
        consoleHandler.setFormatter(logFormatter)
        peachy_logger.addHandler(fileHandler)
        peachy_logger.addHandler(consoleHandler)
        peachy_logger.setLevel(logging_level)
    else:
        logging.basicConfig(filename=logfile, format=logging_format, level=logging_level)
    peachy_logger.info('\n----------------------Logging Started------------------------')
def setup_logging(args):
    logging_path = get_logfile_path()
    peachy_logger = logging.getLogger('peachy')
    logfile = os.path.join(logging_path, 'peachyinstaller.log')
    logging_format = '%(levelname)s: %(asctime)s %(module)s - %(message)s'
    logging_level = getattr(logging, args.loglevel.upper(), 'INFO')
    if (not isinstance(logging_level, int)):
        raise ValueError(('Invalid log level: %s' % args.loglevel))
    if True:
        peachy_logger = logging.getLogger('peachy')
        peachy_logger.propagate = False
        logFormatter = logging.Formatter(logging_format)
        fileHandler = logging.FileHandler(logfile)
        consoleHandler = logging.StreamHandler()
        fileHandler.setFormatter(logFormatter)
        consoleHandler.setFormatter(logFormatter)
        peachy_logger.addHandler(fileHandler)
        peachy_logger.addHandler(consoleHandler)
        peachy_logger.setLevel(logging_level)
    else:
        logging.basicConfig(filename=logfile, format=logging_format, level=logging_level)
    peachy_logger.info('\n----------------------Logging Started------------------------')