| | |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_l2_trade_cancel, logger_l2_trade_buy, logger_trade_record, logger_l2_trade, \ |
| | | logger_l2_s_cancel, logger_l2_h_cancel, logger_l2_l_cancel |
| | | logger_l2_s_cancel, logger_l2_h_cancel, logger_l2_l_cancel, logger_l2_error |
| | | |
| | | threadIds = {} |
| | | |
| | | |
| | | def __add_async_log(logger_, code, content, *args): |
| | | try: |
| | | if len(args) > 0: |
| | | async_log_util.debug(logger_, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | else: |
| | | async_log_util.debug(logger_, |
| | | "thread-id={} code={} ".format(threadIds.get(code), code) + content) |
| | | except Exception as e: |
| | | logger_l2_error.exception(e) |
| | | |
| | | |
| | | def debug(code, content, *args): |
| | | async_log_util.debug(logger_l2_trade, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | __add_async_log(logger_l2_trade, code, content, *args) |
| | | |
| | | |
| | | def buy_debug(code, content, *args): |
| | | async_log_util.debug(logger_l2_trade_buy, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | __add_async_log(logger_l2_trade_buy, code, content, *args) |
| | | |
| | | |
| | | def cancel_debug(code, content, *args): |
| | | async_log_util.debug(logger_l2_trade_cancel, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | __add_async_log(logger_l2_trade_cancel, code, content, *args) |
| | | |
| | | |
| | | def s_cancel_debug(code, content, *args): |
| | | async_log_util.debug(logger_l2_s_cancel, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | __add_async_log(logger_l2_s_cancel, code, content, *args) |
| | | |
| | | |
| | | def h_cancel_debug(code, content, *args): |
| | | async_log_util.debug(logger_l2_h_cancel, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | __add_async_log(logger_l2_h_cancel, code, content, *args) |
| | | |
| | | |
| | | def l_cancel_debug(code, content, *args): |
| | | async_log_util.debug(logger_l2_l_cancel, |
| | | ("thread-id={} code={} ".format(threadIds.get(code), code) + content).format(*args)) |
| | | __add_async_log(logger_l2_l_cancel, code, content, *args) |
| | | |
| | | |
| | | # 交易记录 |
| | | def trade_record(code, type, content, *args): |
| | | async_log_util.debug(logger_trade_record, |
| | | ("thread-id={} code={} type={} data=".format(threadIds.get(code), code, |
| | | type) + content).format(*args)) |
| | | if len(args) > 0: |
| | | async_log_util.debug(logger_trade_record, |
| | | ("thread-id={} code={} type={} data=".format(threadIds.get(code), code, |
| | | type) + content).format(*args)) |
| | | else: |
| | | async_log_util.debug(logger_trade_record, |
| | | "thread-id={} code={} type={} data=".format(threadIds.get(code), code, |
| | | type) + content) |