Browse Source

Replace --no-api-log command line switch with the "special" option "api_logging".

More elegant code and automatically persistent.
pull/370/head
shypike 10 years ago
parent
commit
5c29852033
  1. 5
      SABnzbd.py
  2. 1
      sabnzbd/__init__.py
  3. 1
      sabnzbd/cfg.py
  4. 4
      sabnzbd/interface.py

5
SABnzbd.py

@ -276,7 +276,6 @@ def print_help():
print " with full data reconstruction"
print " --https <port> Port to use for HTTPS server"
print " --log-all Log all article handling (for developers)"
print " --no-api-log Do not log API calls (for developers)"
print " --console Force console logging for OSX app"
print " --new Run a new instance of SABnzbd"
print " --no_ipv6 Do not listen on IPv6 address [::1]"
@ -825,7 +824,7 @@ def commandline_handler(frozen=True):
try:
opts, args = getopt.getopt(info, "phdvncw:l:s:f:t:b:2:",
['pause', 'help', 'daemon', 'nobrowser', 'clean', 'logging=',
'weblogging=', 'server=', 'templates', 'no_ipv6', 'no-api-log',
'weblogging=', 'server=', 'templates', 'no_ipv6',
'template2', 'browser=', 'config-file=', 'force',
'version', 'https=', 'autorestarted', 'repair', 'repair-all',
'log-all', 'no-login', 'pid=', 'new', 'sessions', 'console', 'pidfile=',
@ -976,8 +975,6 @@ def main():
pause = True
elif opt in ('--log-all',):
sabnzbd.LOG_ALL = True
elif opt in ('--no-api-log'):
sabnzbd.API_LOG = False
elif opt in ('--no-login',):
no_login = True
elif opt in ('--pid',):

1
sabnzbd/__init__.py

@ -124,7 +124,6 @@ WEBLOGFILE = None
LOGHANDLER = None
GUIHANDLER = None
LOG_ALL = False
API_LOG = True
AMBI_LOCALHOST = False
WIN_SERVICE = None # Instance of our Win32 Service Class
BROWSER_URL = None

1
sabnzbd/cfg.py

@ -194,6 +194,7 @@ fsys_type = OptionNumber('misc', 'fsys_type', 0, 0, 2)
wait_for_dfolder = OptionBool('misc', 'wait_for_dfolder', False)
warn_empty_nzb = OptionBool('misc', 'warn_empty_nzb', True)
sanitize_safe = OptionBool('misc', 'sanitize_safe', False)
api_logging = OptionBool('misc', 'api_logging', True)
cherryhost = OptionStr('misc', 'host', DEF_HOST)
if sabnzbd.WIN32:

4
sabnzbd/interface.py

@ -425,7 +425,7 @@ class MainPage(object):
def api(self, **kwargs):
""" Handler for API over http, with explicit authentication parameters """
if not kwargs.get('tickleme') or not cfg.web_watchdog():
if sabnzbd.API_LOG:
if cfg.api_logging():
logging.debug('API-call from %s [%s] %s', cherrypy.request.remote.ip,
cherrypy.request.headers.get('User-Agent', '??'), kwargs)
if kwargs.get('mode', '') not in ('version', 'auth'):
@ -1364,7 +1364,7 @@ SPECIAL_BOOL_LIST = \
'no_ipv6', 'keep_awake', 'empty_postproc',
'web_watchdog', 'wait_for_dfolder', 'warn_empty_nzb', 'enable_bonjour',
'warn_dupl_jobs', 'enable_par_cleanup',
'enable_https_verification'
'enable_https_verification', 'api_logging'
)
SPECIAL_VALUE_LIST = \
('size_limit', 'folder_max_length', 'fsys_type', 'movie_rename_limit', 'nomedia_marker',

Loading…
Cancel
Save