Skip to content

Instantly share code, notes, and snippets.

@bsavelev
Created February 6, 2017 18:06
Show Gist options
  • Save bsavelev/d359019804e348ed8a4a628cf9af517c to your computer and use it in GitHub Desktop.
Save bsavelev/d359019804e348ed8a4a628cf9af517c to your computer and use it in GitHub Desktop.
class TestLogLineObserver(util.LogLineObserver):
path = '/tmp/tmp.log'
def __init__(self, step):
self.step = step
util.LogLineObserver.__init__(self)
def outLineReceived(self, line):
buildnumber = self.step.getProperty('buildnumber')
buildername = self.step.getProperty('buildername')
with open(self.path, 'a') as f:
f.write('%s-%s.%s: %s\n' % (
buildername,
self.step.name,
buildnumber,
line
))
class ShellStep(ShellCommand):
haltOnFailure = True
def __init__(self, **kwargs):
ShellCommand.__init__(self, **kwargs)
self.addLogObserver('stdio', TestLogLineObserver(self))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment