small refactor for log_snapshot_on_error

Change-Id: I7cb79862069f2db8a56e15cc9099d875625a31f2