From 51fbd0698c63f0ab909e45532d4dc3e64cee35a2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 6 Dec 2020 19:57:48 +0100 Subject: [PATCH] Move get_logs to be static method --- freqtrade/rpc/api_server.py | 2 +- freqtrade/rpc/rpc.py | 3 ++- freqtrade/rpc/telegram.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/freqtrade/rpc/api_server.py b/freqtrade/rpc/api_server.py index 8c2c203e6..e8eaef933 100644 --- a/freqtrade/rpc/api_server.py +++ b/freqtrade/rpc/api_server.py @@ -388,7 +388,7 @@ class ApiServer(RPC): limit: Only get a certain number of records """ limit = int(request.args.get('limit', 0)) or None - return jsonify(self._rpc_get_logs(limit)) + return jsonify(RPC._rpc_get_logs(limit)) @require_login @rpc_catch_errors diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 9ac271ba0..42f26fe74 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -645,7 +645,8 @@ class RPC: } return res - def _rpc_get_logs(self, limit: Optional[int]) -> Dict[str, Any]: + @staticmethod + def _rpc_get_logs(limit: Optional[int]) -> Dict[str, Any]: """Returns the last X logs""" if limit: buffer = bufferHandler.buffer[-limit:] diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 91306bf85..26e87e654 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -683,7 +683,7 @@ class Telegram(RPC): limit = int(context.args[0]) if context.args else 10 except (TypeError, ValueError, IndexError): limit = 10 - logs = self._rpc_get_logs(limit)['logs'] + logs = RPC._rpc_get_logs(limit)['logs'] msgs = '' msg_template = "*{}* {}: {} \\- `{}`" for logrec in logs: