Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
Signed-off-by: Takayuki Murooka <[email protected]>
  • Loading branch information
takayuki5168 committed Dec 10, 2024
1 parent 8011efd commit 22243b0
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def check(log_file, duration_to_count, log_count_threshold, log_format):
recent_log_list = []
unique_frequent_log_list = []

# with open("autoware.log", "r") as f:
with open(log_file, "r") as f:
for full_message in f.readlines():
try:
# The following implementation depends on the log format.
if log_format == "1":
node_name = full_message.split("[")[4].split("]")[0]
timestamp = float(full_message.split("[")[0][:-1])
Expand Down Expand Up @@ -88,8 +88,13 @@ def check(log_file, duration_to_count, log_count_threshold, log_format):
if log_count_threshold <= log_count:
unique_frequent_log_list.append(recent_log_list[i])

for frequent_log in unique_frequent_log_list:
print(frequent_log.full_message)
if len(unique_frequent_log_list) == 0:
print(
"No frequent log. The log format designated by the `-f` option may be different from the actual log format."
)
else:
for frequent_log in unique_frequent_log_list:
print(frequent_log.full_message)


def main():
Expand Down

0 comments on commit 22243b0

Please sign in to comment.