Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eclair and lnd: save log #31

Merged
merged 1 commit into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eclair.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def stop(self):
p.kill()
psutil.wait_procs(alive, timeout=3)
self.thread.join()
super().save_log()


class EclairNode(object):
Expand Down
1 change: 1 addition & 0 deletions lnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def stop(self):
if self.proc.poll() is None:
self.proc.kill()
self.proc.wait()
super().save_log()


class LndNode(object):
Expand Down
9 changes: 6 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@ def start(self):
self.thread.start()
self.running = True

def stop(self):
self.proc.terminate()
self.proc.kill()
def save_log(self):
if self.outputDir:
logpath = os.path.join(self.outputDir, 'log.' + str(int(time.time())))
with open(logpath, 'w') as f:
for l in self.logs:
f.write(l + '\n')

def stop(self):
self.proc.terminate()
self.proc.kill()
self.save_log()

def tail(self):
"""Tail the stdout of the process and remember it.

Expand Down