Use dictionary-based logging config.

This commit is contained in:
Bastian Kleineidam 2012-01-04 21:07:35 +01:00
parent 033280cfb9
commit 9b437fd1e4
11 changed files with 35 additions and 71 deletions

View file

@ -1,7 +1,7 @@
include README.txt doc/install.txt COPYING doc/upgrading.txt
include MANIFEST.in doc/changelog.txt
include config/linkchecker-completion config/create.sql
include config/linkcheckerrc config/logging.conf
include config/linkcheckerrc
include config/linkchecker.apache2.conf install-rpm.sh
include linkchecker.freecode
include cgi-bin/lc.cgi cgi-bin/README

View file

@ -1,60 +0,0 @@
# Logging configuration file for LinkChecker.
# This file should not be edited except for debugging
# LinkChecker internals.
[loggers]
keys=root,linkcheck,cmdline,check,cache,gui,thread
[handlers]
keys=
[formatters]
keys=
# this logger is not used by the application, just a catch-all thingy
[logger_root]
level=DEBUG
handlers=
qualname=root
# global application logger
[logger_linkcheck]
level=INFO
handlers=
propagate=0
qualname=linkcheck
# debug command line processing
[logger_cmdline]
level=INFO
handlers=
propagate=1
qualname=linkcheck.cmdline
# debug checking methods
[logger_check]
level=INFO
handlers=
propagate=1
qualname=linkcheck.check
# debug caches and queues
[logger_cache]
level=INFO
handlers=
propagate=1
qualname=linkcheck.cache
# debug thread locking
[logger_thread]
level=INFO
handlers=
propagate=1
qualname=linkcheck.thread
# debug gui interface
[logger_gui]
level=INFO
handlers=
propagate=1
qualname=linkcheck.gui

1
debian/changelog vendored
View file

@ -2,6 +2,7 @@ linkchecker (7.4-1) unstable; urgency=low
* New upstream release.
+ Requires Python >= 2.7
+ Remove old conffile /etc/linkchecker/logging.conf
* Use debhelper v8.
-- Bastian Kleineidam <calvin@debian.org> Mon, 02 Jan 2012 12:25:46 +0100

View file

@ -1,2 +1 @@
/etc/linkchecker/linkcheckerrc /usr/share/linkchecker/linkcheckerrc
/etc/linkchecker/logging.conf /usr/share/linkchecker/logging.conf

View file

@ -16,8 +16,14 @@ esac
if [ -f /etc/linkcheckerrc ]; then
mv -f /etc/linkcheckerrc /etc/linkchecker/linkcheckerrc.old || true
fi
# remove old logging conffile
if [ -f /etc/linkchecker/logging.conf ]; then
rm -f /etc/linkchecker/logging.conf || true
fi
# remove system conffile for versions >= 7.0
dpkg-maintscript-helper rm_conffile /etc/linkchecker/linkcheckerrc 6.9 -- "$@"
# remove system conffile for versions >= 7.4
dpkg-maintscript-helper rm_conffile /etc/linkchecker/logging.conf 7.3 -- "$@"
#DEBHELPER#

View file

@ -26,5 +26,7 @@ if [ "$1" = "purge" ]; then
fi
# remove system conffile for versions >= 7.0
dpkg-maintscript-helper rm_conffile /etc/linkchecker/linkcheckerrc 6.9 -- "$@"
# remove system conffile for versions >= 7.4
dpkg-maintscript-helper rm_conffile /etc/linkchecker/logging.conf 7.3 -- "$@"
exit 0

View file

@ -28,6 +28,8 @@ esac
# remove system conffile for versions >= 7.0
dpkg-maintscript-helper rm_conffile /etc/linkchecker/linkcheckerrc 6.9 -- "$@"
# remove system conffile for versions >= 7.4
dpkg-maintscript-helper rm_conffile /etc/linkchecker/logging.conf 7.3 -- "$@"
exit 0

1
debian/rules vendored
View file

@ -30,7 +30,6 @@ override_dh_auto_install:
dh_auto_install --buildsystem python_distutils
# install system wide configuration files in etc
install -m 644 config/linkcheckerrc $(ETCDIR)/linkchecker/
install -m 644 config/logging.conf $(ETCDIR)/linkchecker/
# install CGI files
install -m 644 cgi-bin/lconline/*.html $(HTMLDIR)
install -m 644 cgi-bin/lconline/*.de $(HTMLDIR)

View file

@ -8,7 +8,9 @@ Changes:
- checking: The archive attribute of <applet> and <object> is a
comma-separated list of URIs. The value is now split and each URI
is checked separately.
- cmdline: remove deprecated options.
- cmdline: Remove deprecated options.
- configuration: The dictionary-based logging configuration is now
used. The logging.conf file has been removed.
Features:
- checking: Add HTML5 link elements and attributes.

View file

@ -51,6 +51,22 @@ This is free software, and you are welcome to redistribute it
under certain conditions. Look at the file `LICENSE' within this
distribution."""
# logging configuration
configdict = {
'version': 1,
'loggers': {
},
'root': {
'level': 'DEBUG',
},
}
# configure the application loggers
for applog in lognames.values():
# propagate except for root app logger 'linkcheck'
propagate = (applog != LOG_ROOT)
configdict['loggers'][applog] = dict(level='INFO', propagate=propagate)
def normpath (path):
"""Norm given system path with all available norm or expand functions
@ -197,16 +213,13 @@ class Configuration (dict):
def init_logging (self, status_logger, debug=None, handler=None):
"""
Load logging.conf file settings to set up the
application logging (not to be confused with check loggers).
When debug is not None it is expected to be a list of
Set up the application logging (not to be confused with check
loggers). When debug is not None it is expected to be a list of
logger names for which debugging will be enabled.
If no thread debugging is enabled, threading will be disabled.
"""
filename = normpath(os.path.join(get_config_dir(), "logging.conf"))
if os.path.isfile(filename):
logging.config.fileConfig(filename)
logging.config.dictConfig(configdict)
if handler is None:
handler = ansicolor.ColoredStreamHandler(strm=sys.stderr)
self.add_loghandler(handler)

View file

@ -522,7 +522,7 @@ myemail = "calvin@users.sourceforge.net"
data_files = [
('share/linkchecker',
['config/linkcheckerrc', 'config/logging.conf',
['config/linkcheckerrc',
'doc/html/lccollection.qhc', 'doc/html/lcdoc.qch']),
('share/linkchecker/examples',
['cgi-bin/lconline/leer.html.en',