Conditions | 1 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 1 |
CRAP Score | 1.512 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | """WebSocket abstraction.""" |
||
10 | @classmethod |
||
11 | 1 | def get_handler(cls, socket): |
|
12 | """Output logs to a web socket, filtering unwanted messages. |
||
13 | |||
14 | Args: |
||
15 | socket: socketio socket. |
||
16 | stream: Object that supports ``write()`` and ``flush()``. |
||
17 | """ |
||
18 | stream = WebSocketStream(socket) |
||
19 | handler = logging.StreamHandler(stream) |
||
20 | handler.addFilter(cls._filter_web_requests) |
||
21 | return handler |
||
22 | |||
51 |