Revision ee1a7617
b/pithos/middleware/log.py | ||
---|---|---|
40 | 40 |
class LoggingConfigMiddleware: |
41 | 41 |
def __init__(self): |
42 | 42 |
'''Initialise the logging setup from settings, called on first request.''' |
43 |
if getattr(settings, 'DEBUG', False): |
|
44 |
logging.basicConfig(level = logging.DEBUG, filename='/tmp/pithos.log', format = '%(asctime)s [%(levelname)s] %(name)s %(message)s', datefmt = '%Y-%m-%d %H:%M:%S') |
|
45 |
else: |
|
46 |
logging.basicConfig(level = logging.INFO, filename='/tmp/pithos.log', format = '%(asctime)s [%(levelname)s] %(name)s %(message)s', datefmt = '%Y-%m-%d %H:%M:%S') |
|
43 |
args = {} |
|
44 |
args['level'] = logging.DEBUG if getattr(settings, 'DEBUG', False) else logging.INFO |
|
45 |
if settings.LOGFILE: |
|
46 |
args['filename'] = settings.LOGFILE |
|
47 |
args['format'] = '%(asctime)s [%(levelname)s] %(name)s %(message)s' |
|
48 |
args['datefmt'] = '%Y-%m-%d %H:%M:%S' |
|
49 |
logging.basicConfig(**args) |
|
47 | 50 |
raise MiddlewareNotUsed('Logging setup only.') |
b/pithos/settings.py.dist | ||
---|---|---|
172 | 172 |
INVITATION_LOGIN_TARGET = 'https://pithos.dev.grnet.gr/im/login/invitation' \ |
173 | 173 |
'?code=%d' \ |
174 | 174 |
'&next=https://pithos.dev.grnet.gr/ui' |
175 |
|
|
176 |
# Use to log to a file. |
|
177 |
LOGFILE = None |
Also available in: Unified diff