Skip to content

Commit 008d6ef

Browse files
author
Francesco Faraone
committed
allow loggers configuration from remote
1 parent 4b26da1 commit 008d6ef

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

connect/eaas/dataclasses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class ConfigurationPayload:
6464
configuration: dict = None
6565
logging_api_key: str = None
6666
environment_type: str = None
67+
log_level: str = None
68+
runner_log_level: str = None
6769

6870
def to_json(self):
6971
return dataclasses.asdict(self)

connect/eaas/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def main():
7272
parser = argparse.ArgumentParser(prog='cextrun')
7373
parser.add_argument('-u', '--unsecure', action='store_true')
7474
parser.add_argument('-d', '--debug', action='store_true', default=False)
75-
parser.add_argument('-e', '--extension-dir', default='/extension', type=pathlib.Path)
7675
data = parser.parse_args()
7776
configure_logger(data.debug)
7877
start(data)

connect/eaas/worker.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,20 @@ async def configuration(self, data):
217217
It will stop the tasks manager so the extension can be
218218
reconfigured, then restart the tasks manager.
219219
"""
220-
self.extension_config = data.configuration
221-
self.logging_api_key = data.logging_api_key
222-
self.environment_type = data.environment_type
220+
if data.configuration:
221+
self.extension_config = data.configuration
222+
if data.logging_api_key:
223+
self.logging_api_key = data.logging_api_key
224+
if data.environment_type:
225+
self.environment_type = data.environment_type
226+
if data.log_level:
227+
logging.getLogger('eaas.extension').setLevel(
228+
getattr(logging, data.log_level),
229+
)
230+
if data.runner_log_level:
231+
logging.getLogger('connect.eaas').setLevel(
232+
getattr(logging, data.runner_log_level),
233+
)
223234
logger.info('Extension configuration has been updated.')
224235

225236
async def pause(self):

0 commit comments

Comments
 (0)