From: Brian Warner Date: Mon, 19 Nov 2007 01:30:55 +0000 (-0700) Subject: logtool: rename get-logs.py to logtool.py X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/frontends?a=commitdiff_plain;h=b502c3fea17ecaf1096c71ff8026f2a788f468a5;p=tahoe-lafs%2Ftahoe-lafs.git logtool: rename get-logs.py to logtool.py --- diff --git a/misc/get-logs.py b/misc/get-logs.py deleted file mode 100644 index 4471d4a0..00000000 --- a/misc/get-logs.py +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/python - -import sys -import foolscap -from foolscap.schema import DictOf, Any -from twisted.internet import reactor -from zope.interface import implements -from twisted.python import log -#log.startLogging(sys.stderr) - - -class RILogObserver(foolscap.RemoteInterface): - def msg(logmsg=DictOf(str, Any())): - return None - -class LogFetcher(foolscap.Referenceable): - implements(RILogObserver) - def start(self, target_furl): - print "Connecting.." - self._tub = foolscap.Tub() - self._tub.startService() - d = self._tub.getReference(target_furl) - d.addCallback(self._got_logpublisher) - d.addErrback(self._error) - - def _error(self, f): - print "ERROR", f - reactor.stop() - - def _got_logpublisher(self, publisher): - print "Connected" - d = publisher.callRemote("subscribe_to_all", self) - d.addErrback(self._error) - - def remote_msg(self, d): - print d - - -target_furl = sys.argv[1] -lf = LogFetcher() -lf.start(target_furl) -#print "starting.." -reactor.run() diff --git a/misc/logtool.py b/misc/logtool.py new file mode 100644 index 00000000..4471d4a0 --- /dev/null +++ b/misc/logtool.py @@ -0,0 +1,43 @@ +#! /usr/bin/python + +import sys +import foolscap +from foolscap.schema import DictOf, Any +from twisted.internet import reactor +from zope.interface import implements +from twisted.python import log +#log.startLogging(sys.stderr) + + +class RILogObserver(foolscap.RemoteInterface): + def msg(logmsg=DictOf(str, Any())): + return None + +class LogFetcher(foolscap.Referenceable): + implements(RILogObserver) + def start(self, target_furl): + print "Connecting.." + self._tub = foolscap.Tub() + self._tub.startService() + d = self._tub.getReference(target_furl) + d.addCallback(self._got_logpublisher) + d.addErrback(self._error) + + def _error(self, f): + print "ERROR", f + reactor.stop() + + def _got_logpublisher(self, publisher): + print "Connected" + d = publisher.callRemote("subscribe_to_all", self) + d.addErrback(self._error) + + def remote_msg(self, d): + print d + + +target_furl = sys.argv[1] +lf = LogFetcher() +lf.start(target_furl) +#print "starting.." +reactor.run()