mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-19 09:13:28 +00:00
Merge pull request #1931 from jerryfletcher21/allow-logging-to-file
allow logging to file and setting LOGGER_LEVEL
This commit is contained in:
@ -42,6 +42,13 @@ LND_GRPC_HOST='localhost:10009'
|
||||
|
||||
REDIS_URL='redis://localhost:6379/1'
|
||||
|
||||
# If set to True, load to console (default is False)
|
||||
# LOG_TO_CONSOLE=True
|
||||
# If set, log to file specified (LOG_TO_CONSOLE should be False)
|
||||
# LOG_FILE="<path>"
|
||||
# Change logger level (default is "WARNING")
|
||||
# LOGGER_LEVEL="WARNING"
|
||||
|
||||
# List of market price public APIs. If the currency is available in more than 1 API, will use median price.
|
||||
MARKET_PRICE_APIS = https://blockchain.info/ticker, https://api.yadio.io/exrates/BTC, https://bitpay.com/rates/BTC, https://criptoya.com/api/btc
|
||||
|
||||
|
@ -12,7 +12,6 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import textwrap
|
||||
from pathlib import Path
|
||||
|
||||
@ -59,7 +58,7 @@ CORS_ALLOW_ALL_ORIGINS = True
|
||||
SESSION_COOKIE_HTTPONLY = False
|
||||
|
||||
# Logging settings
|
||||
if os.environ.get("LOG_TO_CONSOLE"):
|
||||
if config("LOG_TO_CONSOLE", cast=bool, default=False):
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
@ -70,12 +69,33 @@ if os.environ.get("LOG_TO_CONSOLE"):
|
||||
},
|
||||
"root": {
|
||||
"handlers": ["console"],
|
||||
"level": "WARNING",
|
||||
"level": config("LOGGER_LEVEL", cast=str, default="WARNING"),
|
||||
},
|
||||
"loggers": {
|
||||
"api.utils": {
|
||||
"handlers": ["console"],
|
||||
"level": "WARNING",
|
||||
"level": config("LOGGER_LEVEL", cast=str, default="WARNING"),
|
||||
},
|
||||
},
|
||||
}
|
||||
elif config("LOG_FILE", False):
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"handlers": {
|
||||
"file": {
|
||||
"class": "logging.FileHandler",
|
||||
"filename": config("LOG_FILE", cast=str),
|
||||
},
|
||||
},
|
||||
"root": {
|
||||
"handlers": ["file"],
|
||||
"level": config("LOGGER_LEVEL", cast=str, default="WARNING"),
|
||||
},
|
||||
"loggers": {
|
||||
"api.utils": {
|
||||
"handlers": ["file"],
|
||||
"level": config("LOGGER_LEVEL", cast=str, default="WARNING"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user