diff options
author | Erik Johnston <erik@matrix.org> | 2017-02-23 11:15:31 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-02-23 11:15:31 +0000 |
commit | 1a4f8022e6312856b0888639d224e84d505202eb (patch) | |
tree | ecf119e388478a855478db7d47c850be5a1d1fc7 /synapse/storage | |
parent | Remove lock from rotate notifs (diff) | |
download | synapse-1a4f8022e6312856b0888639d224e84d505202eb.tar.xz |
Strip newlines from SQL queries
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/_base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index b0dc391190..557701d0c4 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -80,7 +80,13 @@ class LoggingTransaction(object): def executemany(self, sql, *args): self._do_execute(self.txn.executemany, sql, *args) + def _make_sql_one_line(self, sql): + "Strip newlines out of SQL so that the loggers in the DB are on one line" + return " ".join(l.strip() for l in sql.splitlines() if l.strip()) + def _do_execute(self, func, sql, *args): + sql = self._make_sql_one_line(sql) + # TODO(paul): Maybe use 'info' and 'debug' for values? sql_logger.debug("[SQL] {%s} %s", self.name, sql) |