Skip to content

Commit e8bca8b

Browse files
committed
change debug-output from warning to info
1 parent a95e62e commit e8bca8b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/oxl_opnsense_client/basic/ansible.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def exit_json(data: dict):
6767
raise NotImplemented
6868

6969
def warn(self, msg: str):
70-
self._module_input.c.warn(msg)
70+
self._module_input.c.debug_or_warn(msg)
7171

7272
def fail_json(self, msg: str):
7373
self._module_input.c.fail(msg)

src/oxl_opnsense_client/basic/client.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,19 @@ def warn(self, msg: str):
198198
else:
199199
print(f"WARN: {msg}")
200200

201-
@staticmethod
202-
def info(msg: str):
203-
print(f"INFO: {msg}")
201+
def info(self, msg: str):
202+
if self.shell:
203+
print(f"\x1b[1;34mINFO: {msg}\x1b[0m\n")
204+
205+
else:
206+
print(f"INFO: {msg}")
207+
208+
def debug_or_warn(self, msg: str):
209+
if self.debug:
210+
self.info(msg)
211+
212+
else:
213+
self.warn(msg)
204214

205215
def __enter__(self):
206216
return self

0 commit comments

Comments
 (0)