mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
add nullpool to db, crop newlines in logs
This commit is contained in:
parent
fa6d1f9528
commit
d02c1fb70a
1 changed files with 9 additions and 0 deletions
|
@ -31,6 +31,7 @@ from sqlalchemy.orm import mapper, sessionmaker as _sessionmaker, relation, back
|
|||
object_session as _object_session, class_mapper
|
||||
from sqlalchemy.sql import select, text, and_
|
||||
from sqlalchemy.exceptions import DBAPIError, OperationalError
|
||||
from sqlalchemy.pool import NullPool
|
||||
import sqlalchemy
|
||||
|
||||
# some users are still on 0.4.x..
|
||||
|
@ -45,6 +46,14 @@ except ImportError:
|
|||
from sqlalchemy import Unicode
|
||||
UnicodeText = Unicode
|
||||
|
||||
# don't allow newlines when logging
|
||||
import logging
|
||||
_originalLog = logging.Logger._log
|
||||
def _log(self, level, msg, *arg, **kwarg):
|
||||
return _originalLog(
|
||||
self, level, msg.replace("\n", " "), *arg, **kwarg)
|
||||
logging.Logger._log = _log
|
||||
|
||||
from anki.hooks import runHook
|
||||
|
||||
# shared metadata
|
||||
|
|
Loading…
Reference in a new issue