128 self.timestamp = timestamp |
128 self.timestamp = timestamp |
129 self.source = source |
129 self.source = source |
130 self.target = target |
130 self.target = target |
131 self.data = data |
131 self.data = data |
132 |
132 |
133 def __repr__ (self) : |
133 def format_type (self) : |
134 return "channel=%s, offset=%s, type=%s, timestamp=%s, source=%s, target=%s, data=%s" % ( |
134 """ |
135 self.channel, self.offset, LogTypes.name_from_code(self.type), self.timestamp, self.source, self.target, self.data |
135 Formats type as a string code |
|
136 """ |
|
137 |
|
138 return LogTypes.name_from_code(self.type) |
|
139 |
|
140 def format_source (self) : |
|
141 """ |
|
142 Formats source as <nickname>:<chanflags>!<username>@<hostname>, omitting those parts that are missing |
|
143 """ |
|
144 |
|
145 nick, user, host, flags = self.source |
|
146 |
|
147 return "%s%s%s%s" % ( |
|
148 nick if nick else '', |
|
149 ':' + flags if flags else '', |
|
150 '!' + user if user else '', |
|
151 '@' + host if host else '' |
136 ) |
152 ) |
137 |
153 |
|
154 def __repr__ (self) : |
|
155 return "LogLine(%r, %s, %-12s, %s, %-35s, %-10s, %r)" % ( |
|
156 self.channel, self.offset, self.format_type(), self.timestamp, self.format_source(), self.target, self.data |
|
157 ) |
|
158 |