diff --git a/aw_cli/__main__.py b/aw_cli/__main__.py index c302be62..38b25085 100644 --- a/aw_cli/__main__.py +++ b/aw_cli/__main__.py @@ -9,7 +9,7 @@ import click -from aw_cli.log import find_oldest_log, print_log, LOGLEVELS +from aw_cli.log import find_latest_log, print_log, LOGLEVELS from typing import Optional @@ -63,20 +63,20 @@ def logs( testing = ctx.parent.params["testing"] logdir: Path = Path(get_log_dir(None)) - # find the oldest logfile in each of the subdirectories in the logging directory, and print the last lines in each one. + # find the latest logfile in each of the subdirectories in the logging directory, and print the lines in each one. if module_name: - print_oldest_log(logdir / module_name, testing, since, level) + print_latest_log(logdir / module_name, testing, since, level) else: for subdir in sorted(logdir.iterdir()): if subdir.is_dir(): - print_oldest_log(subdir, testing, since, level) + print_latest_log(subdir, testing, since, level) -def print_oldest_log(path, testing, since, level): - path = find_oldest_log(path, testing) - if path: - print_log(path, since, level) +def print_latest_log(path, testing, since, level): + logfile = find_latest_log(path, testing) + if logfile: + print_log(logfile, since, level) else: print(f"No logfile found in {path}") diff --git a/aw_cli/log.py b/aw_cli/log.py index e55593ef..76d2b015 100644 --- a/aw_cli/log.py +++ b/aw_cli/log.py @@ -39,7 +39,7 @@ def print_log( print(f" (Filtered {lines_printed}/{len(lines)} lines)") -def find_oldest_log(path: Path, testing=False) -> Path: +def find_latest_log(path: Path, testing=False) -> Path: if not path.is_dir(): return