self.pakfire = pakfire
self._config = {
- "debug" : True,
+ "debug" : False,
"logfile" : "/var/log/pakfire.log",
"source_download_url" : SOURCE_DOWNLOAD_URL,
"local_build_repo_path" : LOCAL_BUILD_REPO_PATH,
logging.debug("Logging was already set up. Don't do this again.")
return
- # Remove all previous defined handlers
+ # Remove all previous defined handlers.
for handler in l.handlers:
l.removeHandler(handler)
- if config.get("debug"):
- l.setLevel(logging.DEBUG)
+ # Set level of logger always to DEBUG.
+ l.setLevel(logging.DEBUG)
+ # But only log all the debugging stuff on console if
+ # we are running in debugging mode.
handler = logging.StreamHandler()
+
+ if config.get("debug"):
+ handler.setLevel(logging.DEBUG)
+ else:
+ handler.setLevel(logging.INFO)
+
l.addHandler(handler)
+ # The configuration file always logs all messages.
handler = logging.FileHandler(config.get("logfile"))
handler.setLevel(logging.DEBUG)
l.addHandler(handler)