Mercurial > libervia-backend
comparison sat/core/log_config.py @ 2836:ad00f61fd9f5
core (log): add traceback when "exc_info" is set
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 03 Mar 2019 12:04:55 +0100 |
parents | 003b8b4b56a7 |
children | ab2696e34d29 |
comparison
equal
deleted
inserted
replaced
2835:6aa22011bc6d | 2836:ad00f61fd9f5 |
---|---|
32 super(TwistedLogger, self).__init__(*args, **kwargs) | 32 super(TwistedLogger, self).__init__(*args, **kwargs) |
33 from twisted.python import log as twisted_log | 33 from twisted.python import log as twisted_log |
34 | 34 |
35 self.twisted_log = twisted_log | 35 self.twisted_log = twisted_log |
36 | 36 |
37 def out(self, message, level=None): | 37 def out(self, message, level=None, **kwargs): |
38 """Actually log the message | 38 """Actually log the message |
39 | 39 |
40 @param message: formatted message | 40 @param message: formatted message |
41 """ | 41 """ |
42 if kwargs.get('exc_info', False): | |
43 message = self.addTraceback(message) | |
42 self.twisted_log.msg( | 44 self.twisted_log.msg( |
43 message.encode("utf-8", "ignore"), sat_logged=True, level=level | 45 message.encode("utf-8", "ignore"), sat_logged=True, level=level |
44 ) | 46 ) |
45 | 47 |
46 | 48 |