2 Storage class for P2P logging information.
4 Built on previous work by Adriana Draghici, Marius Sandu-Popa, Razvan
5 Deaconescu and Mariana Marasoiu.
7 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
16 import storage # Use *Message classes.
19 # Logging code heavily inspired by Logging HOWTO documentation:
20 # http://docs.python.org/dev/howto/logging.html#configuring-logging
23 # Create logger; default logging level is DEBUG.
24 logger = logging.getLogger(__name__)
25 logger.setLevel(logging.DEBUG)
27 # Create console handler and set level to ERROR.
28 ch = logging.StreamHandler()
29 ch.setLevel(logging.DEBUG)
32 formatter = logging.Formatter('%(filename)s:%(lineno)s - %(levelname)s: %(message)s')
34 # Add formatter to console handler.
35 ch.setFormatter(formatter)
37 # Add console handler to logger.
40 class SessionLogParser(object):
42 Top-level class for parsing log file(s) for a given BitTorrent session.
45 def __init__(self, path):
48 def get_next_message(self):
50 Find next message in log file/folder. May be status, peer status
52 Return None when all logs have been parsed.
56 class LibtorrentLogParser(object):
58 libtorrent-rasterbar log folder parser.
61 def __init__(self, path):
62 super(LibtorrrentLogParser, self).__init__(path)
64 def get_next_message(self):
66 Go through all files in libtorrent log folder and parse them.
67 Return the next message available or None when all logs have
72 class TriblerLogParser(object):
74 Tribler log file parser.
77 def __init__(self, path):
78 super(LibtorrrentLogParser, self).__init__(path)
80 def get_next_message(self):
82 Go through all files in libtorrent log folder and parse them.
83 Return the next message available or None when all logs have