Просмотр исходного кода

Add a default logging configuration file, and small typo fixes

Guillaume Ayoub 15 лет назад
Родитель
Сommit
899379d073
3 измененных файлов с 71 добавлено и 5 удалено
  1. 6 3
      config
  2. 63 0
      logging
  3. 2 2
      radicale/log.py

+ 6 - 3
config

@@ -1,3 +1,6 @@
+# -*- mode: conf -*-
+# vim:ft=cfg
+
 # Config file for Radicale - A simple calendar server
 #
 # Place it into /etc/radicale/config (global) 
@@ -5,6 +8,7 @@
 #
 # The current values are the default ones
 
+
 [server]
 # CalDAV server hostnames separated by a comma
 # IPv4 syntax: address:port
@@ -31,6 +35,7 @@ stock = utf-8
 # Value: None | htpasswd | LDAP
 type = None
 # Personal calendars only available for logged in users
+# If True, /alice/calendar will only be available for alice
 personal = False
 # Htpasswd filename
 htpasswd_filename = /etc/radicale/users
@@ -55,6 +60,4 @@ folder = ~/.config/radicale/calendars
 # http://docs.python.org/library/logging.config.html
 config = /etc/radicale/logging
 # Set the default logging level to debug
-debug = False
-
-# vim:ft=cfg
+debug = False

+ 63 - 0
logging

@@ -0,0 +1,63 @@
+# -*- mode: conf -*-
+# vim:ft=cfg
+
+# Logging config file for Radicale - A simple calendar server
+#
+# The default path for this file is /etc/radicale/logging
+# This can be changed in the configuration file
+#
+# Other handlers are available. For more information, see:
+# http://docs.python.org/library/logging.config.html
+
+
+# Loggers, handlers and formatters keys
+
+[loggers]
+# Loggers names, main configuration slots
+keys=root
+
+[handlers]
+# Logging handlers, defining logging output methods
+keys=console,file
+
+[formatters]
+# Logging formatters
+keys=simple,full
+
+
+# Loggers
+
+[logger_root]
+# Root logger
+level=DEBUG
+handlers=console,file
+
+
+# Handlers
+
+[handler_console]
+# Console handler
+class=StreamHandler
+level=INFO
+args=(sys.stdout,)
+formatter=simple
+
+[handler_file]
+# File handler
+class=FileHandler
+level=DEBUG
+args=('/var/log/radicale',)
+formatter=full
+
+
+# Formatter
+
+[formatter_simple]
+# Simple output format
+format=%(message)s
+datefmt=
+
+[formatter_full]
+# Full output format
+format=%(asctime)s - %(levelname)s: %(message)s
+datefmt=

+ 2 - 2
radicale/log.py

@@ -32,7 +32,7 @@ import logging.config
 from radicale import config
 
 
-LOGGER = logging.getLogger("radicale")
+LOGGER = logging.getLogger()
 FILENAME = os.path.expanduser(config.get("logging", "config"))
 
 def start(debug=False):
@@ -46,5 +46,5 @@ def start(debug=False):
     else:
         # Default configuration, standard output
         handler = logging.StreamHandler(sys.stdout)
-        handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
+        handler.setFormatter(logging.Formatter("%(message)s"))
         LOGGER.addHandler(handler)