~thekorn/+junk/central-logging-service

« back to all changes in this revision

Viewing changes to src/log_reciever.py

  • Committer: Markus Korn
  • Date: 2011-08-04 12:38:18 UTC
  • Revision ID: markus.korn@edelight.de-20110804123818-icdnghzkx7uwzggh
Added a new (optional) "role" identifier to log entries and fixed indention in log_reciever.py
(actually the role identifier is just an idea, maybe we want sth. like tagging support. There
needs to be a searchable and readable way to organize a huge number of log entries. Filtering
context and level does not seem to be good enough.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from logbook.more import ColorizedStderrHandler
6
6
 
7
7
class WSReciever(object):
8
 
        
9
 
        def __init__(self, uri):
10
 
                self.ws = websocket.WebSocketApp(uri, on_message=self.on_message)
11
 
                
12
 
        def run_forever(self):
13
 
                self.ws.run_forever()
 
8
    
 
9
    def __init__(self, uri):
 
10
        self.ws = websocket.WebSocketApp(uri, on_message=self.on_message)
 
11
    
 
12
    def run_forever(self):
 
13
        self.ws.run_forever()
14
14
 
15
 
        def on_message(self, ws, message):
16
 
                record = json.loads(message)
17
 
                record = LogRecord.from_dict(record)
18
 
                dispatch_record(record)
19
 
                
 
15
    def on_message(self, ws, message):
 
16
        record = json.loads(message)
 
17
        record = LogRecord.from_dict(record)
 
18
        dispatch_record(record)
 
19
        
20
20
 
21
21
if __name__ == "__main__":
22
22
    handler = ColorizedStderrHandler()