mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Changed nzbtomedia_configure_logging to accept a logfile paramater so that in the future if wanted we could log to seperate files
This commit is contained in:
parent
6cffd5364d
commit
4c35248561
8 changed files with 10 additions and 10 deletions
|
@ -436,7 +436,7 @@ if __name__ == "__main__":
|
|||
migratecfg.migrate()
|
||||
|
||||
# Logging
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
|
@ -28,9 +28,9 @@ def safeName(name):
|
|||
return safename
|
||||
|
||||
|
||||
def nzbtomedia_configure_logging(dirname):
|
||||
def nzbtomedia_configure_logging(logfile):
|
||||
logging.config.fileConfig(CONFIG_FILE)
|
||||
fileHandler = logging.handlers.RotatingFileHandler(LOG_FILE, mode='a', maxBytes=1048576, backupCount=1, encoding='utf-8', delay=True)
|
||||
fileHandler = logging.handlers.RotatingFileHandler(logfile, mode='a', maxBytes=1048576, backupCount=1, encoding='utf-8', delay=True)
|
||||
fileHandler.formatter = logging.Formatter('%(asctime)s|%(levelname)-7.7s %(message)s', '%H:%M:%S')
|
||||
fileHandler.level = logging.DEBUG
|
||||
logging.getLogger().addHandler(fileHandler)
|
||||
|
|
|
@ -135,7 +135,7 @@ if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.c
|
|||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
migratecfg.addnzbget()
|
||||
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
|
@ -71,7 +71,7 @@ if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.c
|
|||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
migratecfg.addnzbget()
|
||||
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
|
@ -81,7 +81,7 @@ if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.c
|
|||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
migratecfg.addnzbget()
|
||||
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
|
@ -297,10 +297,10 @@ elif config():
|
|||
migratecfg.migrate()
|
||||
|
||||
# check to write settings from nzbGet UI to autoProcessMedia.cfg.
|
||||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
if config() and os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
migratecfg.addnzbget()
|
||||
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
|
@ -74,7 +74,7 @@ if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.c
|
|||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
migratecfg.addnzbget()
|
||||
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
|
@ -138,7 +138,7 @@ if os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.c
|
|||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
||||
migratecfg.addnzbget()
|
||||
|
||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||
nzbtomedia_configure_logging(LOG_FILE)
|
||||
Logger = logging.getLogger(__name__)
|
||||
|
||||
Logger.info("====================") # Seperate old from new log
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue