diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-11-20 17:10:37 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-11-20 17:10:37 +0000 |
commit | dfdda2c8718b11bff9eb69d382eff72c9f8a3d79 (patch) | |
tree | 23b5cb61864bcffc5a0fd371758bf97febcd0367 /synapse/api | |
parent | Add a few missing yields, Move deferred lists inside PreserveLoggingContext b... (diff) | |
download | synapse-dfdda2c8718b11bff9eb69d382eff72c9f8a3d79.tar.xz |
Use module loggers rather than the root logger. Exceptions caused by bad clients shouldn't cause ERROR level logging. Fix sql logging to use 'repr' rather than 'str'
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/errors.py | 7 | ||||
-rw-r--r-- | synapse/api/events/__init__.py | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py index 33d15072af..581439ceb3 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -17,6 +17,8 @@ import logging +logger = logging.getLogger(__name__) + class Codes(object): UNAUTHORIZED = "M_UNAUTHORIZED" @@ -38,7 +40,7 @@ class CodeMessageException(Exception): """An exception with integer code and message string attributes.""" def __init__(self, code, msg): - logging.error("%s: %s, %s", type(self).__name__, code, msg) + logger.info("%s: %s, %s", type(self).__name__, code, msg) super(CodeMessageException, self).__init__("%d: %s" % (code, msg)) self.code = code self.msg = msg @@ -140,7 +142,8 @@ def cs_exception(exception): if isinstance(exception, CodeMessageException): return exception.error_dict() else: - logging.error("Unknown exception type: %s", type(exception)) + logger.error("Unknown exception type: %s", type(exception)) + return {} def cs_error(msg, code=Codes.UNKNOWN, **kwargs): diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py index a01c4a1351..8a35b4cb7d 100644 --- a/synapse/api/events/__init__.py +++ b/synapse/api/events/__init__.py @@ -83,6 +83,8 @@ class SynapseEvent(JsonEncodedObject): "content", ] + outlier = False + def __init__(self, raises=True, **kwargs): super(SynapseEvent, self).__init__(**kwargs) # if "content" in kwargs: |