예제 #1
0
    def __init__(self, bitshares_instance, config):
        self.bitshares_instance = bitshares_instance
        set_shared_bitshares_instance(bitshares_instance)
        self.config = config
        self.worker_manager = None

        # Configure logging
        data_dir = user_data_dir(APP_NAME, AUTHOR)
        filename = os.path.join(data_dir, 'dexbot.log')
        formatter = logging.Formatter(
            '%(asctime)s - %(worker_name)s using account %(account)s on %(market)s - %(levelname)s - %(message)s'
        )
        logger = logging.getLogger("dexbot.per_worker")
        fh = logging.FileHandler(filename)
        fh.setFormatter(formatter)
        logger.addHandler(fh)
        logger.setLevel(logging.INFO)
        self.pyqt_handler = PyQtHandler()
        self.pyqt_handler.setLevel(logging.INFO)
        logger.addHandler(self.pyqt_handler)
        logger.info("DEXBot {} on python {} {}".format(VERSION,
                                                       sys.version[:6],
                                                       sys.platform),
                    extra={
                        'worker_name': 'NONE',
                        'account': 'NONE',
                        'market': 'NONE'
                    })

        # Configure orders logging
        initialize_orders_log()
예제 #2
0
파일: cli.py 프로젝트: bue-twitter/DEXBot
# We need to do this before importing click
if "LANG" not in os.environ:
    os.environ['LANG'] = 'C.UTF-8'
import click  # noqa: E402


log = logging.getLogger(__name__)

# Initial logging before proper setup.
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s %(levelname)s %(message)s'
)

# Configure orders logging
initialize_orders_log()

# Initialize data folders
initialize_data_folders()


@click.group()
@click.option(
    "--configfile",
    default=DEFAULT_CONFIG_FILE,
)
@click.option(
    '--logfile',
    default=None,
    type=click.Path(dir_okay=False, writable=True),
    help='Override logfile location (example: ~/dexbot.log)'