Skip to content

Commit

Permalink
Add config option to enable log output
Browse files Browse the repository at this point in the history
  • Loading branch information
ninad-kamat committed Jul 12, 2023
1 parent 4d29eea commit f31d344
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ansys/meshing/prime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
disable_optimizing_numpy_arrays,
numpy_array_optimization_enabled,
numpy_array_optimization_disabled,
enable_log_output,
)

import ansys.meshing.prime.examples as examples
Expand Down
16 changes: 16 additions & 0 deletions src/ansys/meshing/prime/internals/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
'using_container',
'set_has_pim',
'has_pim',
'enable_log_output',
]

__DEFAULT_USE_BINARY = False
__USING_CONTAINER = False
__HAS_PIM = False
__FILE_CHECK = True

from ansys.meshing.prime.internals.logger import PrimeLogger


def _optimize_vectors():
"""Get the value of the flag for optimizing vectors."""
Expand Down Expand Up @@ -190,3 +193,16 @@ def set_file_existence_check(value: bool):
global __FILE_CHECK
__FILE_CHECK = value
return __FILE_CHECK


def enable_log_output(stream=None):
"""Enable logger output to given stream.
If stream is not specified, sys.stderr is used.
Parameters
----------
stream: TextIO, optional
Stream to output the log output to stream
"""
PrimeLogger().enable_output(stream)

0 comments on commit f31d344

Please sign in to comment.