summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-11-13 23:10:10 -0200
committerdrebs <drebs@riseup.net>2017-11-14 19:01:15 -0200
commit1aa09423eea6849a14cd0a36345ef088f34e469a (patch)
tree8ead6772d55006104cc1eea30d13854a0a13966f
parent7bda8b8396756eeaf6635a0183372a9962f51c53 (diff)
[bug] use custom logger everywhere in server
-rw-r--r--src/leap/soledad/server/_blobs.py4
-rw-r--r--src/leap/soledad/server/_incoming.py19
-rw-r--r--src/leap/soledad/server/auth.py4
-rw-r--r--src/leap/soledad/server/entrypoints.py5
-rw-r--r--src/leap/soledad/server/server.tac4
5 files changed, 20 insertions, 16 deletions
diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py
index d608845d..6a4bdca4 100644
--- a/src/leap/soledad/server/_blobs.py
+++ b/src/leap/soledad/server/_blobs.py
@@ -29,7 +29,6 @@ import base64
import json
import re
-from twisted.logger import Logger
from twisted.web import static
from twisted.web import resource
from twisted.web.client import FileBodyProducer
@@ -39,6 +38,7 @@ from twisted.internet import utils, defer
from zope.interface import implementer
from leap.common.files import mkdir_p
+from leap.soledad.common.log import getLogger
from leap.soledad.server import interfaces
from leap.soledad.common.blobs import ACCEPTED_FLAGS
@@ -46,7 +46,7 @@ from leap.soledad.common.blobs import ACCEPTED_FLAGS
__all__ = ['BlobsResource']
-logger = Logger()
+logger = getLogger(__name__)
# Used for sanitizers, we accept only letters, numbers, '-' and '_'
VALID_STRINGS = re.compile('^[a-zA-Z0-9_-]+$')
diff --git a/src/leap/soledad/server/_incoming.py b/src/leap/soledad/server/_incoming.py
index 1ccf74df..e4ca4de8 100644
--- a/src/leap/soledad/server/_incoming.py
+++ b/src/leap/soledad/server/_incoming.py
@@ -19,26 +19,29 @@ A twisted resource that saves externally delivered documents into user's db.
"""
import json
import base64
-from twisted.logger import Logger
+
+from io import BytesIO
from twisted.web.server import NOT_DONE_YET
from twisted.web.resource import Resource
from twisted.web.test.test_web import DummyRequest
-from ._config import get_config
-from io import BytesIO
-from leap.soledad.server._blobs import BlobsServerState
-from leap.soledad.common.couch.state import CouchServerState
-from leap.soledad.common.document import ServerDocument
+
from leap.soledad.common.blobs import Flags
+from leap.soledad.common.blobs import preamble
+from leap.soledad.common.couch.state import CouchServerState
from leap.soledad.common.crypto import ENC_JSON_KEY
from leap.soledad.common.crypto import ENC_SCHEME_KEY
from leap.soledad.common.crypto import EncryptionSchemes
-from leap.soledad.common.blobs import preamble
+from leap.soledad.common.document import ServerDocument
+from leap.soledad.common.log import getLogger
+
+from leap.soledad.server._config import get_config
+from leap.soledad.server._blobs import BlobsServerState
__all__ = ['IncomingResource']
-logger = Logger()
+logger = getLogger(__name__)
def _get_backend_from_config():
diff --git a/src/leap/soledad/server/auth.py b/src/leap/soledad/server/auth.py
index d0884e01..637666da 100644
--- a/src/leap/soledad/server/auth.py
+++ b/src/leap/soledad/server/auth.py
@@ -33,11 +33,11 @@ from twisted.cred.credentials import UsernamePassword
from twisted.cred.portal import IRealm
from twisted.cred.portal import Portal
from twisted.internet import defer
-from twisted.logger import Logger
from twisted.web.iweb import ICredentialFactory
from twisted.web.resource import IResource
from leap.soledad.common.couch import couch_server
+from leap.soledad.common.log import getLogger
from ._resource import PublicResource, AnonymousResource
from ._resource import LocalResource
@@ -45,7 +45,7 @@ from ._blobs import BlobsResource
from ._config import get_config
-log = Logger()
+log = getLogger(__name__)
def _update_with_defaults(conf):
diff --git a/src/leap/soledad/server/entrypoints.py b/src/leap/soledad/server/entrypoints.py
index 0237978e..0509cc75 100644
--- a/src/leap/soledad/server/entrypoints.py
+++ b/src/leap/soledad/server/entrypoints.py
@@ -18,14 +18,15 @@
Entrypoints for the Soledad server.
"""
from twisted.internet import reactor
-from twisted.logger import Logger
from twisted.python import threadpool
+from leap.soledad.common.log import getLogger
+
from .auth import localPortal, publicPortal
from .session import SoledadSession
-log = Logger()
+log = getLogger(__name__)
class UsersEntrypoint(SoledadSession):
diff --git a/src/leap/soledad/server/server.tac b/src/leap/soledad/server/server.tac
index 3737e7df..16667df3 100644
--- a/src/leap/soledad/server/server.tac
+++ b/src/leap/soledad/server/server.tac
@@ -18,15 +18,15 @@ import sys
import os
from twisted.application import service, strports
-from twisted.logger import Logger
from twisted.web import server
from leap.soledad.common.couch.check import check_schema_versions
+from leap.soledad.common.log import getLogger
from leap.soledad.server import entrypoints
from leap.soledad.server import get_config
-logger = Logger(__name__)
+logger = getLogger(__name__)
#