Skip to content

Commit

Permalink
log exit code and pid on verbose logging
Browse files Browse the repository at this point in the history
Is useful for debugging on daemon.
  • Loading branch information
skshetry committed Oct 18, 2023
1 parent b35b942 commit fa3785b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dvc/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ def main(argv=None): # noqa: C901, PLR0912, PLR0915
args = None

outer_log_level = logger.level
level = None
try:
args = parse_args(argv)

level = None
if args.quiet:
level = logging.CRITICAL
elif args.verbose == 1:
Expand Down Expand Up @@ -235,11 +235,15 @@ def main(argv=None): # noqa: C901, PLR0912, PLR0915
ret = _log_exceptions(exc) or 255

try:
import os

from dvc import analytics

if analytics.is_enabled():
analytics.collect_and_send_report(args, ret)

logger.trace("pid %s exiting with %s", os.getpid(), ret) # type: ignore[attr-defined]

return ret
finally:
logger.setLevel(outer_log_level)
Expand Down

0 comments on commit fa3785b

Please sign in to comment.