terom@41: """ terom@41: A channel represents a series of log events, stored in some log source terom@41: """ terom@41: terom@65: import log_search terom@65: terom@41: class LogChannel (object) : terom@41: """ terom@41: A single IRC channel, logged to some specific place terom@41: """ terom@41: terom@41: def __init__ (self, id, network, name, source) : terom@41: """ terom@41: Initialize this channel from the given identifier key, network name, channel name, and LogSource terom@41: """ terom@41: terom@86: # store terom@41: self.id = id terom@41: self.network = network terom@41: self.name = name terom@41: self.source = source terom@86: terom@86: # bind source terom@86: self.source.bind_channel(self) terom@42: terom@42: @property terom@42: def title (self) : terom@42: """ terom@42: Title is 'Network - #channel' terom@42: """ terom@41: terom@42: return "%s - %s" % (self.network, self.name) terom@65: terom@65: def search (self, query) : terom@65: """ terom@65: Perform a search on this channel, returning a sequence of LogLines terom@65: """ terom@42: terom@65: return log_search.index.search_simple(self, query) terom@65: terom@90: def __str__ (self) : terom@90: """ terom@90: Returns self.title terom@90: """ terom@90: terom@90: return self.title terom@90: terom@90: def __repr__ (self) : terom@90: """ terom@90: Uses self.id terom@90: """ terom@90: terom@90: return "LogChannel(%s)" % (self.id, ) terom@90: