mirror of
https://github.com/KevinMidboe/transatlanticTorrentExpress.git
synced 2025-10-29 18:00:19 +00:00
Config gets a new elastic field for logging to dynamic elastic host.
This commit is contained in:
@@ -8,3 +8,7 @@ local=
|
|||||||
|
|
||||||
[DELUGE]
|
[DELUGE]
|
||||||
script=
|
script=
|
||||||
|
|
||||||
|
[ELASTIC]
|
||||||
|
host=
|
||||||
|
port=
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import os
|
|||||||
import json
|
import json
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
from utils import getConfig
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
LOG_FILE = os.path.join(BASE_DIR, 'output.log')
|
LOG_FILE = os.path.join(BASE_DIR, 'output.log')
|
||||||
|
|
||||||
@@ -45,7 +47,10 @@ class ESHandler(logging.Handler):
|
|||||||
response = response.read().decode('utf8')
|
response = response.read().decode('utf8')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
eh = ESHandler(host='localhost')
|
config = getConfig()
|
||||||
|
esHost = config['ELASTIC']['host']
|
||||||
|
esPort = config['ELASTIC']['port']
|
||||||
|
eh = ESHandler(host=esHost, port=esPort)
|
||||||
eh.setLevel(logging.DEBUG)
|
eh.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
formatter = logging.Formatter('%(asctime)s %(levelname)8s | %(message)s')
|
formatter = logging.Formatter('%(asctime)s %(levelname)8s | %(message)s')
|
||||||
|
|||||||
Reference in New Issue
Block a user