mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
Enable warnings logging to console via envvar
This commit is contained in:
parent
f0cde287e1
commit
6f1e865a15
@ -2,12 +2,12 @@ import json
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
import requests
|
||||
import ring
|
||||
import requests, ring, logging
|
||||
from decouple import config
|
||||
|
||||
from api.models import Order
|
||||
|
||||
logger = logging.getLogger('api.utils')
|
||||
|
||||
def get_tor_session():
|
||||
session = requests.session()
|
||||
@ -52,7 +52,8 @@ def validate_onchain_address(address):
|
||||
validation = bitcoind_rpc('validateaddress', [address])
|
||||
if not validation['isvalid']:
|
||||
return False, {"bad_address": "Invalid address"}
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return False, {"bad_address": 'Unable to validate address, check bitcoind backend'}
|
||||
|
||||
return True, None
|
||||
|
@ -29,6 +29,7 @@ DEBUG = False
|
||||
STATIC_URL = "static/"
|
||||
STATIC_ROOT = "/usr/src/static/"
|
||||
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
if os.environ.get("DEVELOPMENT"):
|
||||
DEBUG = True
|
||||
@ -48,6 +49,28 @@ ALLOWED_HOSTS = [
|
||||
# Allows Session Cookie to be read by Javascript on Client side.
|
||||
SESSION_COOKIE_HTTPONLY = False
|
||||
|
||||
# Logging settings
|
||||
if os.environ.get("LOG_TO_CONSOLE"):
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': 'WARNING',
|
||||
},
|
||||
'loggers': {
|
||||
'api.utils': {
|
||||
'handlers': ['console'],
|
||||
'level': 'WARNING',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
Loading…
Reference in New Issue
Block a user