diff options
Diffstat (limited to 'swiftstory')
-rw-r--r-- | swiftstory/Client.py | 3 | ||||
-rw-r--r-- | swiftstory/GameManager.py | 3 | ||||
-rw-r--r-- | swiftstory/SwiftStory.py | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/swiftstory/Client.py b/swiftstory/Client.py index 6f98301..45e2f96 100644 --- a/swiftstory/Client.py +++ b/swiftstory/Client.py @@ -1,4 +1,5 @@ import asyncio +import logging from swiftstory.Status import error @@ -66,7 +67,7 @@ class Client: try: await self.socket.send(message) except websockets.exceptions.ConnectionClosed: - print("Recipient has disconnected.") + logging.warning("Recipient has disconnected.") asyncio.create_task(f()) diff --git a/swiftstory/GameManager.py b/swiftstory/GameManager.py index e3b5e78..a7098bc 100644 --- a/swiftstory/GameManager.py +++ b/swiftstory/GameManager.py @@ -1,3 +1,4 @@ +import logging import os from swiftstory.Game import Game @@ -28,7 +29,7 @@ class GameManager: game = games.get(game_name) if game is None: - print('Starting new game') + logging.info("Starting new game: %s (lang: %s)", game_name, lang) game = games[game_name] = Game(white_cards, black_cards) diff --git a/swiftstory/SwiftStory.py b/swiftstory/SwiftStory.py index 0451062..f9799ef 100644 --- a/swiftstory/SwiftStory.py +++ b/swiftstory/SwiftStory.py @@ -4,6 +4,7 @@ import argparse import asyncio import contextlib import json +import logging import websockets import swiftstory.GameManager @@ -79,6 +80,8 @@ def main(): parser.add_argument('--port', type=int, default=1236) args = vars(parser.parse_args()) + logging.basicConfig(level=logging.INFO) + start_server = websockets.serve(connection_handler, args['listen'], args['port']) asyncio.get_event_loop().run_until_complete(start_server) |