custom_logging_functions module¶
-
custom_logging_functions.
autogen_C_logging_code
(logging_dict)¶ Function that autogenerates PRINTF statements for binaryc. intput is a dictionary where the key is the header of that logging line and items which are lists of parameters that will be put in that logging line
Example:
{'MY_STELLAR_DATA': [ 'model.time', 'star[0].mass', 'model.probability', 'model.dt' ] }
-
custom_logging_functions.
binary_c_log_code
(code)¶ Function to construct the code to construct the custom logging function
-
custom_logging_functions.
binary_c_write_log_code
(code, filename)¶ Function to write the generated logging code to a file
Function to write the custom logging code to a file and then compile it.
-
custom_logging_functions.
create_and_load_logging_function
(custom_logging_code)¶ Function to automatically compile the shared library with the given custom logging code and load it with ctypes
- returns:
memory adress of the custom logging function in a int type.
-
custom_logging_functions.
from_binary_c_config
(config_file, flag)¶ Function to run the binaryc_config command with flags
-
custom_logging_functions.
return_compilation_dict
()¶ Function to build the compile command for the shared library
inspired by binary_c_inline_config command in perl
TODO: this function still has some cleaning up to do wrt default values for the compile command # https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc/
- returns:
string containing the command to build the shared library
-
custom_logging_functions.
temp_custom_logging_dir
()¶ Function to return the path the custom logging library shared object and script will be written to.
Makes use of os.makedirs exist_ok which requires python 3.2+