Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
code-webis-cmd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
code-generic
code-webis-cmd
Commits
59e20eae
Commit
59e20eae
authored
Nov 06, 2017
by
Michael Völske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
suppress DEBUG messages by default; add flag to enable them
parent
c998de44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
libs/log.py
libs/log.py
+8
-1
webis.py
webis.py
+4
-1
No files found.
libs/log.py
View file @
59e20eae
...
...
@@ -13,6 +13,12 @@ from __future__ import print_function
from
sys
import
stderr
from
collections
import
namedtuple
_log_settings
=
{
'debug'
:
False
}
def
set_verbose_logging
(
is_enabled
):
_log_settings
[
'debug'
]
=
is_enabled
def
colorred
(
m
):
return
"
\033
[91m"
+
m
+
"
\033
[0m"
...
...
@@ -38,7 +44,8 @@ def lError(msg):
def
lDbg
(
msg
):
print
(
colorblue
(
"[DEBUG] "
)
+
str
(
msg
),
file
=
stderr
)
if
_log_settings
[
'debug'
]:
print
(
colorblue
(
"[DEBUG] "
)
+
str
(
msg
),
file
=
stderr
)
def
lWarn
(
msg
):
...
...
webis.py
View file @
59e20eae
...
...
@@ -122,7 +122,7 @@ def run_subcommand(subcommand, subcommandpath, params=[]):
cmd
=
" "
.
join
([
subcommandpath
]
+
params
)
return_value
=
os
.
system
(
cmd
)
if
return_value
==
0
:
l
Info
(
"Done."
)
l
Dbg
(
"Done."
)
else
:
lError
(
"An error occurred while executing "
+
cmd
)
return
return_value
...
...
@@ -142,6 +142,8 @@ def main(args):
commands
=
get_commands
(
config
)
parser
=
argparse
.
ArgumentParser
()
parser
.
register
(
'action'
,
'parsers'
,
AliasedSubParsersAction
)
parser
.
add_argument
(
'-v'
,
'--verbose'
,
help
=
'Print debug messages.'
,
action
=
'store_true'
)
subparsers
=
{}
allcommands
=
{}
...
...
@@ -177,6 +179,7 @@ def main(args):
parseresults
=
parser
.
parse_known_args
(
args
)
argsdict
=
vars
(
parseresults
[
0
])
set_verbose_logging
(
argsdict
[
'verbose'
])
parameter
=
parseresults
[
1
]
if
argsdict
[
'<command>'
]
not
in
subparsers
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment