Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change logging default value to be error #77

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions codegen/adr_utils.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ def get_logger(logfile=None):
The logger object.
"""
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.setLevel(logging.ERROR)
if logfile is None:
# Logging for Python APIs should be disabled by default
ch = logging.NullHandler()
elif logfile=='stdout':
ch = logging.StreamHandler(sys.stdout)
else:
ch = logging.FileHandler(logfile)
ch.setLevel(logging.DEBUG)
ch.setLevel(logging.ERROR)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/dynamicreporting/core/adr_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def stop(self) -> None:
except Exception:
pass
if v is False:
self.logger.warning("Error validating the connected service. Can't shut it down.\n")
self.logger.error("Error validating the connected service. Can't shut it down.\n")
else:
# If coming from a docker image, clean that up
try:
Expand All @@ -556,7 +556,7 @@ def stop(self) -> None:
self.logger.info("Told service to shutdown.\n")
self.serverobj.stop_local_server()
except Exception as e:
self.logger.warning(f"Problem shutting down service.\n{str(e)}\n")
self.logger.error(f"Problem shutting down service.\n{str(e)}\n")
pass

if self._delete_db and self._db_directory:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_unit_nexus_stop(request) -> bool:
a = Service(logfile=logfile)
a.stop()
f = open(logfile)
assert "There is no service connected to the current session" in f.read()
assert "Error validating the connected service" in f.read()


@pytest.mark.ado_test
Expand Down
Loading