equal
deleted
inserted
replaced
34 self.module = module |
34 self.module = module |
35 |
35 |
36 def handleError (self, msg) : |
36 def handleError (self, msg) : |
37 log.err(msg) |
37 log.err(msg) |
38 self.module.error(msg) |
38 self.module.error(msg) |
|
39 |
|
40 def connectionLost (self, reason) : |
|
41 """ |
|
42 The transport we were connected to has dropped, possibly as a result of our handlers raising an error? |
|
43 """ |
|
44 |
|
45 self.handleError("lost LogSource for %s: %s" % (self.name, reason.getErrorMessage())) |
39 |
46 |
40 def handleData (self, data) : |
47 def handleData (self, data) : |
41 """ |
48 """ |
42 Feed binary data into the buffer, processing all lines via handleLine() |
49 Feed binary data into the buffer, processing all lines via handleLine() |
43 """ |
50 """ |
107 continue |
114 continue |
108 |
115 |
109 else : |
116 else : |
110 raise ValueError(out) |
117 raise ValueError(out) |
111 |
118 |
|
119 def logPrefix (self) : |
|
120 return "LogSource(%s)" % (self.name, ) |
|
121 |
112 class File (LogSource, protocol.ProcessProtocol) : |
122 class File (LogSource, protocol.ProcessProtocol) : |
113 """ |
123 """ |
114 Stream lines from a regular file using /usr/bin/tail -f |
124 Stream lines from a regular file using /usr/bin/tail -f |
115 """ |
125 """ |
116 |
126 |
147 def dataReceived (self, data) : |
157 def dataReceived (self, data) : |
148 self.handleData(data) |
158 self.handleData(data) |
149 |
159 |
150 def handleEOF (self) : |
160 def handleEOF (self) : |
151 self.handleError("!!! EOF on fifo %s, re-opening" % self.name) |
161 self.handleError("!!! EOF on fifo %s, re-opening" % self.name) |
152 self.reopen() |
162 self.reopen() |
153 |
|
154 def connectionLost (self, reason) : |
|
155 super(Fifo, self).connectionLost(reason) |
|
156 self.handleError("lost fifo for %s: %s" % (self.name, reason.getErrorMessage())) |
|
157 |
163 |
158 class UnixDatagramSocket (LogSource, protocol.DatagramProtocol) : |
164 class UnixDatagramSocket (LogSource, protocol.DatagramProtocol) : |
159 """ |
165 """ |
160 Stream messages from a UNIX datagram socket |
166 Stream messages from a UNIX datagram socket |
161 """ |
167 """ |
178 """ |
184 """ |
179 |
185 |
180 # handle it as a line of data |
186 # handle it as a line of data |
181 self.handleLine(data) |
187 self.handleLine(data) |
182 |
188 |
183 def logPrefix (self) : |
|
184 return "LogSource(%s)" % (self.name, ) |
|
185 |
189 |