Skip to content

Commit

Permalink
feat: log up-to-date when single entry
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao authored and lilydjwg committed Mar 11, 2024
1 parent 471b66f commit 71af793
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nvchecker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def main() -> None:
oldvers = core.read_verfile(options.ver_files[0])
else:
oldvers = {}
result_coro = core.process_result(oldvers, result_q, entry_waiter)
result_coro = core.process_result(oldvers, result_q, entry_waiter, verbose=bool(args.entry))
runner_coro = core.run_tasks(futures)

if sys.version_info >= (3, 10):
Expand Down
11 changes: 8 additions & 3 deletions nvchecker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ def _process_result(r: RawResult) -> Union[Result, Exception]:
return ValueError('no version returned')

def check_version_update(
oldvers: VersData, r: Result,
oldvers: VersData,
r: Result,
verbose: bool,
) -> None:
oldver = oldvers.get(r.name, None)
if not oldver or oldver != r.version:
Expand All @@ -383,12 +385,15 @@ def check_version_update(
url = r.url,
)
else:
logger.debug('up-to-date', name=r.name, version=r.version, url=r.url)
# provide visible user feedback if it was the only entry
level = logging.info if verbose else logging.debug
logger.log(level, 'up-to-date', name=r.name, version=r.version, url=r.url)

async def process_result(
oldvers: VersData,
result_q: Queue[RawResult],
entry_waiter: EntryWaiter,
verbose: bool = False,
) -> Tuple[VersData, bool]:
ret = {}
has_failures = False
Expand All @@ -404,7 +409,7 @@ async def process_result(
entry_waiter.set_exception(r.name, r1)
has_failures = True
continue
check_version_update(oldvers, r1)
check_version_update(oldvers, r1, verbose)
entry_waiter.set_result(r1.name, r1.version)
ret[r1.name] = r1.version
except asyncio.CancelledError:
Expand Down

0 comments on commit 71af793

Please sign in to comment.