change verbosity level in logging
authorKali Kaneko <kali@leap.se>
Tue, 3 Sep 2013 13:53:04 +0000 (15:53 +0200)
committerKali Kaneko <kali@leap.se>
Tue, 3 Sep 2013 13:55:17 +0000 (15:55 +0200)
src/leap/common/events/client.py
src/leap/common/events/server.py

index ff1f52a..83f18e0 100644 (file)
@@ -133,12 +133,13 @@ def register(signal, callback, uid=None, replace=False, reqcbk=None,
     request.mac = ""
     service = RpcService(proto.EventsServerService_Stub,
                          server.SERVER_PORT, 'localhost')
-    logger.info(
+    logger.debug(
         "Sending registration request to server on port %s: %s",
         server.SERVER_PORT,
         str(request)[:40])
     return service.register(request, callback=reqcbk, timeout=timeout)
 
+
 def unregister(signal, uid=None, reqcbk=None, timeout=1000):
     """
     Unregister a callback.
@@ -226,7 +227,7 @@ def signal(signal, content="", mac_method="", mac="", reqcbk=None,
     request.mac = mac
     service = RpcService(proto.EventsServerService_Stub, server.SERVER_PORT,
                          'localhost')
-    logger.info("Sending signal to server: %s", str(request)[:40])
+    logger.debug("Sending signal to server: %s", str(request)[:40])
     return service.signal(request, callback=reqcbk, timeout=timeout)
 
 
@@ -251,7 +252,7 @@ def ping(port, reqcbk=None, timeout=1000):
         proto.EventsClientService_Stub,
         port,
         'localhost')
-    logger.info("Pinging a client in port %d..." % port)
+    logger.debug("Pinging a client in port %d..." % port)
     return service.ping(request, callback=reqcbk, timeout=timeout)
 
 
@@ -277,7 +278,7 @@ class EventsClientService(proto.EventsClientService):
         :param done: callback to be called when done
         :type done: protobuf.socketrpc.server.Callback
         """
-        logger.info('Received signal from server: %s...' % str(request)[:40])
+        logger.debug('Received signal from server: %s...' % str(request)[:40])
 
         # run registered callbacks
         # TODO: verify authentication using mac in incoming message
@@ -303,7 +304,7 @@ class EventsClientService(proto.EventsClientService):
         :param done: callback to be called when done
         :type done: protobuf.socketrpc.server.Callback
         """
-        logger.info("Received ping request, sending response.")
+        logger.debug("Received ping request, sending response.")
         response = proto.EventResponse()
         response.status = proto.EventResponse.OK
         done.run(response)
index 861cb4f..dc55551 100644 (file)
@@ -85,6 +85,7 @@ def ensure_server(port=SERVER_PORT):
         logger.info('Launching server on port %d.', port)
         return EventsServerDaemon.ensure(port)
 
+
 def process_ping(port, request, response):
     """
     Response callback for the ping event.
@@ -100,7 +101,7 @@ def process_ping(port, request, response):
         logger.info('A server is already running on port %d.', port)
         return
     # port is taken, and not by an events server
-    logger.info('Port %d is taken by something not an events server.', port)
+    logger.warning('Port %d is taken by something not an events server.', port)
     raise PortAlreadyTaken(port)
 
 
@@ -125,7 +126,7 @@ def ping(port=SERVER_PORT, reqcbk=None, timeout=1000):
         proto.EventsServerService_Stub,
         port,
         'localhost')
-    logger.info("Pinging server in port %d..." % port)
+    logger.debug("Pinging server in port %d..." % port)
     return service.ping(request, callback=reqcbk, timeout=timeout)
 
 
@@ -196,14 +197,14 @@ class EventsServerService(proto.EventsServerService):
         :param done: callback to be called when done
         :type done: protobuf.socketrpc.server.Callback
         """
-        logger.info('Received signal from client: %s...', str(request)[:40])
+        logger.debug('Received signal from client: %s...', str(request)[:40])
         # send signal to all registered clients
         # TODO: verify signal auth
         if request.event in registered_clients:
             for port in registered_clients[request.event]:
 
                 def callback(req, resp):
-                    logger.info("Signal received by " + str(port))
+                    logger.debug("Signal received by " + str(port))
 
                 service = RpcService(proto.EventsClientService_Stub,
                                      port, 'localhost')
@@ -224,7 +225,7 @@ class EventsServerService(proto.EventsServerService):
         :param done: callback to be called when done
         :type done: protobuf.socketrpc.server.Callback
         """
-        logger.info("Received ping request, sending response.")
+        logger.debug("Received ping request, sending response.")
         response = proto.EventResponse()
         response.status = proto.EventResponse.OK
         done.run(response)