Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1go committed Nov 21, 2021
1 parent 39c9a86 commit 44a2708
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions eth_sync_committee.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import argparse
from functions import (
get_user_validators, get_epochs, print_all_validators, stringify_list, generate_notification, add_cron_job
get_user_validators, get_epochs, print_all_validators, stringify_list, generate_notification, add_cron_job,
write_log
)
from constants import log_file

if __name__ == '__main__':
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -70,8 +70,7 @@

log_file_str += '\n'

with log_file.open('a') as f:
f.write(log_file_str)
write_log(log_file_str=log_file_str)

if args.notify and current_committee.validators or next_committee.validators:
generate_notification(current_committee=current_committee, next_committee=next_committee)
Expand Down
7 changes: 6 additions & 1 deletion functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from crontab import CronTab

from constants import (
validators_file, config_file,
validators_file, config_file, log_file,
run_command, run_command_notify, run_command_cron,
send_alarm_emails, alarm_intervals,
finalized_url, genesis_url, block_url,
Expand Down Expand Up @@ -373,3 +373,8 @@ def add_cron_job(next_start_time, in_next_committee=False):
cron.write()

return c_str


def write_log(log_file_str):
with log_file.open('a') as f:
f.write(log_file_str)

0 comments on commit 44a2708

Please sign in to comment.