Skip to content

Commit

Permalink
feat: tradingview logging level configuration (chrisleekr#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
azorpax authored Jul 24, 2022
1 parent 2ae7aef commit 526eda9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [Unreleased] - 2022-07-24

- Added TRADINGVIEW_LOG_LEVEL. Thanks [@azorpax](https://github.com/azorpax) - [#436](https://github.com/chrisleekr/binance-trading-bot/pull/436)

## [0.0.87] - 2022-07-23

- Refactored error handling. Thanks [@habibalkhabbaz](https://github.com/habibalkhabbaz) - [#434](https://github.com/chrisleekr/binance-trading-bot/pull/434)
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.rpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ services:
networks:
- internal
restart: unless-stopped
environment:
# https://docs.python.org/3/howto/logging.html#logging-levels
- TRADINGVIEW_LOG_LEVEL=INFO
logging:
driver: 'json-file'
options:
Expand All @@ -45,8 +48,7 @@ services:
volumes:
- redis_data:/data
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
command:
redis-server /usr/local/etc/redis/redis.conf --requirepass secretp422
command: redis-server /usr/local/etc/redis/redis.conf --requirepass secretp422

binance-mongo:
container_name: binance-mongo
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ services:
networks:
- internal
restart: unless-stopped
environment:
# https://docs.python.org/3/howto/logging.html#logging-levels
- TRADINGVIEW_LOG_LEVEL=INFO
logging:
driver: 'json-file'
options:
Expand All @@ -44,8 +47,7 @@ services:
volumes:
- redis_data:/data
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
command:
redis-server /usr/local/etc/redis/redis.conf --requirepass secretp422
command: redis-server /usr/local/etc/redis/redis.conf --requirepass secretp422

binance-mongo:
container_name: binance-mongo
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ services:
restart: unless-stopped
environment:
- PYTHONUNBUFFERED=1
# https://docs.python.org/3/howto/logging.html#logging-levels
- TRADINGVIEW_LOG_LEVEL=INFO
ports:
- 8082:8080
logging:
Expand All @@ -59,8 +61,7 @@ services:
volumes:
- redis_data:/data
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
command:
redis-server /usr/local/etc/redis/redis.conf --requirepass secretp422
command: redis-server /usr/local/etc/redis/redis.conf --requirepass secretp422

binance-mongo:
container_name: binance-mongo
Expand Down
3 changes: 2 additions & 1 deletion tradingview/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import logging
import sys
import colorlog
import os

from flask import Flask, jsonify, request
from tradingview_ta import get_multiple_analysis

app = Flask(__name__)

logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
logger.setLevel(os.environ.get("TRADINGVIEW_LOG_LEVEL", logging.DEBUG))
sh = logging.StreamHandler(sys.stdout)
sh.setFormatter(colorlog.ColoredFormatter(
'%(log_color)s [%(asctime)s] %(levelname)s [%(filename)s.%(funcName)s:%(lineno)d] %(message)s', datefmt='%a, %d %b %Y %H:%M:%S'))
Expand Down

0 comments on commit 526eda9

Please sign in to comment.