log2zulip: Remove unnecessary loop and fix incorrect variable name.
This commit is contained in:
parent
ca1b415a1b
commit
1231da46bf
|
@ -66,8 +66,7 @@ def process_lines(raw_lines, file_name):
|
|||
|
||||
def process_logs():
|
||||
# type: () -> None
|
||||
for filename in log_files:
|
||||
data_file_path = os.path.join(temp_dir, "log2zulip.state")
|
||||
data_file_path = os.path.join(temp_dir, "log2zulip.state")
|
||||
mkdir_p(os.path.dirname(data_file_path))
|
||||
if not os.path.exists(data_file_path):
|
||||
open(data_file_path, "w").write("{}")
|
||||
|
@ -91,7 +90,7 @@ def process_logs():
|
|||
output = subprocess.check_output(["tail", "-n+%s" % (file_data["last"],), log_file])
|
||||
new_lines = output.decode('utf-8', errors='replace').split('\n')[:-1]
|
||||
if len(new_lines) > 0:
|
||||
process_lines(new_lines, filename)
|
||||
process_lines(new_lines, log_file)
|
||||
file_data["last"] += len(new_lines)
|
||||
new_data[log_file] = file_data
|
||||
open(data_file_path, "w").write(json.dumps(new_data))
|
||||
|
|
Loading…
Reference in a new issue