dymad.utils.misc¶
Functions
|
Configure a logger with specified mode and prefix. |
|
Load a YAML configuration file and optionally merge with a dictionary. |
|
Setup logging configuration based on the config file. |
- dymad.utils.misc.config_logger(logger, mode='info', prefix='.')¶
Configure a logger with specified mode and prefix. The function is intended for a logger instantiated in a class.
- Parameters:
logger (logging.Logger) – Logger instance to configure.
mode (str) – Logging mode, either ‘debug’ or ‘info’. Default is ‘info’.
prefix (str) – Prefix for the log file. Default is ‘.’ (current directory).
- Return type:
None
- dymad.utils.misc.load_config(config_path, config_mod=None)¶
Load a YAML configuration file and optionally merge with a dictionary.
- Parameters:
config_path (str) – Path to the YAML configuration file.
config_mod (dict, optional) – Dictionary to merge into the config.
- Returns:
Merged configuration dictionary.
- Return type:
dict
- dymad.utils.misc.setup_logging(config_path='', mode='info', prefix='.')¶
Setup logging configuration based on the config file. Assuming the config file name is in the format ‘<case>.yaml’
- Parameters:
config_path (str) – Path to the configuration file.
mode (str) – Logging mode, either ‘debug’ or ‘info’. Default is ‘info’.
prefix (str) – Directory prefix for the log file. Default is ‘.’ (current directory).
- Return type:
None