Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions adb-sync
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,15 @@ def FixPath(src: bytes, dst: bytes) -> Tuple[bytes, bytes]:
return (src, dst)


def main() -> None:
logging.basicConfig(level=logging.INFO)
def GetLogLevel(name: str) -> int:
"""Returns the numeric value for the named logging level."""
level = getattr(logging, name.upper(), logging.INFO)
if not isinstance(level, int):
return logging.INFO
return level


def main() -> None:
parser = argparse.ArgumentParser(
description='Synchronize a directory between an Android device and the '
'local file system')
Expand Down Expand Up @@ -792,12 +798,21 @@ def main() -> None:
'--copy-links',
action='store_true',
help='transform symlink into referent file/dir')
parser.add_argument(
'--log',
metavar='LEVEL',
default='INFO',
type=str,
help='Minimum log level to display - one of: '
'DEBUG INFO WARNING ERROR CRITICAL (default: INFO).')
parser.add_argument(
'--dry-run',
action='store_true',
help='Do not do anything - just show what would be done.')
args = parser.parse_args()

logging.basicConfig(level=GetLogLevel(args.log))

localpatterns = [os.fsencode(x) for x in args.source]
remotepath = os.fsencode(args.destination)
adb_args = os.fsencode(args.adb).split(b' ')
Expand Down