summaryrefslogtreecommitdiff
path: root/alot/init.py
diff options
context:
space:
mode:
authordtk <dtk@gmx.de>2012-01-05 03:20:33 +0100
committerdtk <dtk@gmx.de>2012-01-05 03:20:33 +0100
commit2872b718cc8489601c99646ddba2af9a047acb99 (patch)
tree9ceffb985c8cc74992fb821409c3d36b84555810 /alot/init.py
parent543ae78adea51c84b10125cfc375925bc93226ee (diff)
Fix basic logging functionality
This commit roughly restores the broken logging functionality. The first few messages are still logged to `stderr` as well as to the specified log file. Closes #170.
Diffstat (limited to 'alot/init.py')
-rwxr-xr-xalot/init.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/alot/init.py b/alot/init.py
index 5ce1d586..34d3810a 100755
--- a/alot/init.py
+++ b/alot/init.py
@@ -138,7 +138,12 @@ def main():
numeric_loglevel = getattr(logging, args['debug-level'].upper(), None)
logfilename = os.path.expanduser(args['logfile'])
logging.basicConfig(level=numeric_loglevel, filename=logfilename)
+ log_formatter = logging.Formatter('%(levelname)s:%(message)s')
+ log_handler = logging.FileHandler(logfilename, encoding='utf-8')
+ log_handler.setFormatter(log_formatter)
logger = logging.getLogger()
+ logger.setLevel(numeric_loglevel)
+ logger.addHandler(log_handler)
#logger.debug(commands.COMMANDS)
# get ourselves a database manager