Skip to content

Commit

Permalink
Merge pull request #398 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
Readme Update Pull Request
  • Loading branch information
Herklos authored Sep 12, 2018
2 parents d8fd08c + eb1345d commit fa6ae97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions services/telegram_service.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import telegram
from telegram.ext import Updater # , Dispatcher
import logging

from config.cst import *
from interfaces.telegram.bot import TelegramApp
from services.abstract_service import *
from tools.logging.logging_util import set_logging_level


class TelegramService(AbstractService):
REQUIRED_CONFIG = {"chat-id": "", "token": ""}

LOGGERS = ["telegram.bot", "telegram.ext.updater", "telegram.vendor.ptb_urllib3.urllib3.connectionpool"]

def __init__(self):
super().__init__()
self.telegram_api = None
Expand All @@ -35,6 +39,8 @@ def prepare(self):
if TelegramApp.is_enabled(self.config):
self.telegram_app = TelegramApp(self.config, self, self.telegram_updater)

set_logging_level(self.LOGGERS, logging.WARNING)

def get_type(self):
return CONFIG_TELEGRAM

Expand Down
2 changes: 1 addition & 1 deletion start.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def start_octobot(starting_args):

except ConfigEvaluatorError:
logger.error("OctoBot can't start without a valid " + CONFIG_EVALUATOR_FILE_PATH
+ "configuration file.\nThis file is generated on tentacle "
+ " configuration file.\nThis file is generated on tentacle "
"installation using the following command:\nstart.py -p install all")
os._exit(-1)

Expand Down
5 changes: 5 additions & 0 deletions tools/logging/logging_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def get_logger(logger_name="Anonymous"):
return BotLogger(logger_name)


def set_logging_level(logger_names, level):
for name in logger_names:
logging.getLogger(name).setLevel(level)


class BotLogger:

def __init__(self, logger_name):
Expand Down
2 changes: 1 addition & 1 deletion trading/exchanges/exchange_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, config, exchange_type, exchange, exchange_web_socket):
self.reset_symbols_data()
self.exchange_personal_data = ExchangePersonalData()

self.logger.info(f"online with REST api {' and web socket api' if self.exchange_web_socket else ''}")
self.logger.info(f"online with REST api{' and web socket api' if self.exchange_web_socket else ''}")

def reset_symbols_data(self):
self.symbols_data = {}
Expand Down

0 comments on commit fa6ae97

Please sign in to comment.