]>
git.ipfire.org Git - location/debian/libloc.git/blob - src/python/location/logger.py
62ad8fbc268dffa10e227aa4bd0a68ffb52ad6ff
1 ###############################################################################
3 # libloc - A library to determine the location of someone on the Internet #
5 # Copyright (C) 2020 IPFire Development Team <info@ipfire.org> #
7 # This library is free software; you can redistribute it and/or #
8 # modify it under the terms of the GNU Lesser General Public #
9 # License as published by the Free Software Foundation; either #
10 # version 2.1 of the License, or (at your option) any later version. #
12 # This library is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
15 # Lesser General Public License for more details. #
17 ###############################################################################
20 import logging
.handlers
22 # Initialise root logger
23 log
= logging
.getLogger("location")
24 log
.setLevel(logging
.INFO
)
27 handler
= logging
.StreamHandler()
28 handler
.setLevel(logging
.DEBUG
)
29 log
.addHandler(handler
)
32 handler
= logging
.handlers
.SysLogHandler(address
="/dev/log",
33 facility
=logging
.handlers
.SysLogHandler
.LOG_DAEMON
)
34 handler
.setLevel(logging
.INFO
)
35 log
.addHandler(handler
)
37 # Format syslog messages
38 formatter
= logging
.Formatter("%(message)s")
39 handler
.setFormatter(formatter
)
43 Sets the log level for the root logger