blob: 0d1890b5f25c963f1dbff9c33cb0fcdd64a3f1d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import sys
class ExceptionLogger:
"""
Redirect Exceptions to the logger to keep track of them in the log file.
"""
def __init__(self):
self.logger = logging.getLogger()
def write(self, message):
if message != '\n':
self.logger.error(message)
def flush(self):
pass
sys.stderr = ExceptionLogger()
|