Commit 0f0d4418 by Oleksandr Barabash

absl argv added

parent ca3b28c9
...@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__) ...@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
flags.DEFINE_string('station_id', None, "Station_id") flags.DEFINE_string('station_id', None, "Station_id")
flags.DEFINE_string('file_name', None, "File where to save the history") flags.DEFINE_string('file', None, "File where to save the history")
def init_logging(filename=None, level=None): def init_logging(filename=None, level=None):
...@@ -44,12 +44,11 @@ def stop_server(server: WSClient, io_loop: AbstractEventLoop): ...@@ -44,12 +44,11 @@ def stop_server(server: WSClient, io_loop: AbstractEventLoop):
# noinspection PyShadowingNames # noinspection PyShadowingNames
def try_to_log(kr_packet: KrPacketV2, def try_to_log(kr_packet: KrPacketV2) -> None:
log_name: Optional[str] = None) -> None:
""" try to save log into the file """ """ try to save log into the file """
if log_name is not None: if FLAGS.file is not None:
try: try:
with open(log_name, "a") as f: with open(FLAGS.file, "a") as f:
f.write(f"{kr_packet}\r\n") f.write(f"{kr_packet}\r\n")
except IOError: except IOError:
logging.error("save to file error!", exc_info=sys.exc_info()) logging.error("save to file error!", exc_info=sys.exc_info())
...@@ -75,7 +74,7 @@ def handle_message(data: bytes) -> None: ...@@ -75,7 +74,7 @@ def handle_message(data: bytes) -> None:
# noinspection PyShadowingNames # noinspection PyShadowingNames
def main(argv) -> None: def main(_argv) -> None:
""" Main """ """ Main """
logging.getLogger("geventwebsocket").level = logging.WARNING logging.getLogger("geventwebsocket").level = logging.WARNING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment