Skip to content

Commit 846db8c

Browse files
author
Vladimir Kotal
committed
propagate log level version to CommandSequence
1 parent d0a55b4 commit 846db8c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

opengrok-tools/src/main/python/opengrok_tools/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def main():
175175

176176
cmds_base = []
177177
for d in dirs_to_process:
178-
cmd_base = CommandSequenceBase(d, commands,
178+
cmd_base = CommandSequenceBase(d, commands, loglevel,
179179
config.get("cleanup"))
180180
cmds_base.append(cmd_base)
181181

opengrok-tools/src/main/python/opengrok_tools/utils/commandsequence.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from .command import Command
2626
from .webutil import put, post, delete
2727
from .utils import is_web_uri
28+
from .log import get_console_logger
2829
import json
2930

3031

@@ -36,13 +37,14 @@ class CommandSequenceBase:
3637
so that it can be passed through Pool.map().
3738
"""
3839

39-
def __init__(self, name, commands, cleanup=None):
40+
def __init__(self, name, commands, loglevel=logging.INFO, cleanup=None):
4041
self.name = name
4142
self.commands = commands
4243
self.failed = False
4344
self.retcodes = {}
4445
self.outputs = {}
4546
self.cleanup = cleanup
47+
self.loglevel = loglevel
4648

4749
def __str__(self):
4850
return str(self.name)
@@ -65,10 +67,10 @@ class CommandSequence(CommandSequenceBase):
6567
PROJECT_SUBST = '%PROJECT%'
6668

6769
def __init__(self, base):
68-
super().__init__(base.name, base.commands, base.cleanup)
70+
super().__init__(base.name, base.commands, loglevel=base.loglevel,
71+
cleanup=base.cleanup)
6972

70-
self.logger = logging.getLogger(__name__)
71-
logging.basicConfig()
73+
self.logger = get_console_logger(__name__, base.loglevel)
7274

7375
def run_command(self, command):
7476
"""

0 commit comments

Comments
 (0)