update due to new report log handler configuration
This commit is contained in:
parent
a35faaa21f
commit
aeac8b5d1f
@ -1,3 +1,6 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
# Folder to be monitored for new files
|
# Folder to be monitored for new files
|
||||||
TARGET_FOLDER = "{{ server_ftp_scan_target_folder }}"
|
TARGET_FOLDER = "{{ server_ftp_scan_target_folder }}"
|
||||||
|
|
||||||
@ -10,5 +13,11 @@ SMTP_SERVER = "{{ server_ftp_scan_smtp_server }}"
|
|||||||
SMTP_USER = "{{ server_ftp_scan_smtp_user }}"
|
SMTP_USER = "{{ server_ftp_scan_smtp_user }}"
|
||||||
SMTP_PASSWORD = "{{ server_ftp_scan_smtp_password }}"
|
SMTP_PASSWORD = "{{ server_ftp_scan_smtp_password }}"
|
||||||
|
|
||||||
# Possible log-levels: DEBUG, INFO, WARNING, ERROR
|
#
|
||||||
LOG_LEVEL = "INFO"
|
# Logging
|
||||||
|
#
|
||||||
|
APP_NAME = "file2mail"
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
LOG_HOSTNAME = "loggy" # When DEBUG is True
|
||||||
|
LOG_LEVEL = logging.INFO # STDOUT logging
|
||||||
|
13
file2mail.py
13
file2mail.py
@ -2,11 +2,9 @@
|
|||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
import config
|
import config
|
||||||
import fstools
|
import fstools
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import mail
|
import mail
|
||||||
import os
|
import os
|
||||||
import psutil
|
|
||||||
import report
|
import report
|
||||||
import signal
|
import signal
|
||||||
import time
|
import time
|
||||||
@ -14,8 +12,15 @@ import time
|
|||||||
CYCLE_TIME = 60
|
CYCLE_TIME = 60
|
||||||
SLEEP_TIME = .5
|
SLEEP_TIME = .5
|
||||||
|
|
||||||
logger = logging.getLogger('root')
|
try:
|
||||||
report.stdoutLoggingConfigure(log_name_lvl=[('root', config.LOG_LEVEL), ])
|
from config import APP_NAME as ROOT_LOGGER_NAME
|
||||||
|
except ImportError:
|
||||||
|
ROOT_LOGGER_NAME = 'root'
|
||||||
|
logger = logging.getLogger(ROOT_LOGGER_NAME)
|
||||||
|
|
||||||
|
report.add_handler_stdout(logger, config.LOG_LEVEL)
|
||||||
|
if config.DEBUG:
|
||||||
|
report.add_handler_socket(logger, host=config.LOG_HOSTNAME)
|
||||||
|
|
||||||
|
|
||||||
class GracefulKiller:
|
class GracefulKiller:
|
||||||
|
2
fstools
2
fstools
@ -1 +1 @@
|
|||||||
Subproject commit c10e8792abb05671dab6de51cdadda3bf8ead50f
|
Subproject commit 9237f6f7f77eed79b8163077c1b4d87189193fbe
|
2
report
2
report
@ -1 +1 @@
|
|||||||
Subproject commit b53dd30eae1d679b7eec4999bec50aed55bc105b
|
Subproject commit 3b8fbbc0844d17377b3d5da84bca8cad6d24d143
|
Loading…
x
Reference in New Issue
Block a user