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
e41bc9a3
Commit
e41bc9a3
authored
Nov 06, 2017
by
Michael Völske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add optional DEBUG logging also for bash scripts
parent
59e20eae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
libs/bashhelper.sh
libs/bashhelper.sh
+13
-1
libs/log.py
libs/log.py
+4
-0
webis.py
webis.py
+2
-0
No files found.
libs/bashhelper.sh
View file @
e41bc9a3
...
...
@@ -31,7 +31,7 @@ logInfo() {
# Printout debug info if debug enabled.
#
logDebug
()
{
echo
-e
"
\0
33[94m[DEBUG]
\0
33[0m
$@
"
1>&2
;
$(
is_var_set WEBIS_DEBUG
)
&&
echo
-e
"
\0
33[94m[DEBUG]
\0
33[0m
$@
"
1>&2
;
}
#
...
...
@@ -254,6 +254,18 @@ get_group() {
stat
-c
%G
"
$@
"
}
#
# Check if a variable is set
#
# \params $@ NAME
# \return (exit code)
# Example:
# is_var_set FOO && echo "yay! FOO is set!"
is_var_set
()
{
[
!
-z
${
!1+x
}
]
}
#
# Printout settings and check configuration.
#
...
...
libs/log.py
View file @
e41bc9a3
...
...
@@ -19,6 +19,10 @@ def set_verbose_logging(is_enabled):
_log_settings
[
'debug'
]
=
is_enabled
def
is_verbose_logging
():
return
_log_settings
[
'debug'
]
def
colorred
(
m
):
return
"
\033
[91m"
+
m
+
"
\033
[0m"
...
...
webis.py
View file @
e41bc9a3
...
...
@@ -119,6 +119,8 @@ def run_subcommand(subcommand, subcommandpath, params=[]):
pp
=
os
.
environ
.
get
(
'PYTHONPATH'
)
webis_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
os
.
environ
[
'PYTHONPATH'
]
=
webis_dir
if
pp
is
None
else
pp
+
':'
+
webis_dir
if
is_verbose_logging
():
os
.
environ
[
'WEBIS_DEBUG'
]
=
'1'
cmd
=
" "
.
join
([
subcommandpath
]
+
params
)
return_value
=
os
.
system
(
cmd
)
if
return_value
==
0
:
...
...
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