Skip to content

Commit b5d749e

Browse files
authored
Merge pull request #199 from eht16/add_log_level_argument
Add --log-level command line argument
2 parents 00e5c01 + 3d5eb35 commit b5d749e

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

README.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ Usage
3030
CLI Usage is as follows::
3131

3232
github-backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN] [--as-app]
33-
[-o OUTPUT_DIRECTORY] [-i] [--starred] [--all-starred]
34-
[--watched] [--followers] [--following] [--all]
35-
[--issues] [--issue-comments] [--issue-events] [--pulls]
36-
[--pull-comments] [--pull-commits] [--pull-details]
37-
[--labels] [--hooks] [--milestones] [--repositories]
38-
[--bare] [--lfs] [--wikis] [--gists] [--starred-gists]
39-
[--skip-existing] [-L [LANGUAGES [LANGUAGES ...]]]
40-
[-N NAME_REGEX] [-H GITHUB_HOST] [-O] [-R REPOSITORY]
41-
[-P] [-F] [--prefer-ssh] [-v]
33+
[-o OUTPUT_DIRECTORY] [-l LOG_LEVEL] [-i] [--starred]
34+
[--all-starred] [--watched] [--followers] [--following]
35+
[--all] [--issues] [--issue-comments] [--issue-events]
36+
[--pulls] [--pull-comments] [--pull-commits]
37+
[--pull-details] [--labels] [--hooks] [--milestones]
38+
[--repositories] [--bare] [--lfs] [--wikis] [--gists]
39+
[--starred-gists] [--skip-archived] [--skip-existing]
40+
[-L [LANGUAGES ...]] [-N NAME_REGEX] [-H GITHUB_HOST]
41+
[-O] [-R REPOSITORY] [-P] [-F] [--prefer-ssh] [-v]
4242
[--keychain-name OSX_KEYCHAIN_ITEM_NAME]
4343
[--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
4444
[--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
@@ -63,6 +63,9 @@ CLI Usage is as follows::
6363
--as-app authenticate as github app instead of as a user.
6464
-o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
6565
directory at which to backup the repositories
66+
-l LOG_LEVEL, --log-level LOG_LEVEL
67+
log level to use (default: info, possible levels:
68+
debug, info, warning, error, critical)
6669
-i, --incremental incremental backup
6770
--starred include JSON output of starred repositories in backup
6871
--all-starred include starred repositories in backup [*]

bin/github-backup

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def main():
3232
if args.lfs_clone:
3333
check_git_lfs_install()
3434

35+
if args.log_level:
36+
log_level = logging.getLevelName(args.log_level.upper())
37+
if isinstance(log_level, int):
38+
logging.root.setLevel(log_level)
39+
3540
if not args.as_app:
3641
log_info('Backing up user {0} to {1}'.format(args.user, output_directory))
3742
authenticated_user = get_authenticated_user(args)

github_backup/github_backup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ def parse_args(args=None):
162162
default='.',
163163
dest='output_directory',
164164
help='directory at which to backup the repositories')
165+
parser.add_argument('-l',
166+
'--log-level',
167+
default='info',
168+
dest='log_level',
169+
help='log level to use (default: info, possible levels: debug, info, warning, error, critical)')
165170
parser.add_argument('-i',
166171
'--incremental',
167172
action='store_true',

0 commit comments

Comments
 (0)