Closed lejeunemax closed 1 year ago
Got back on this
e.g. changed to
lg.info('Effective wind speed of turbine %s : %s m/s' % (i_t, ueff))
from
lg.info(f'Effective wind speed of turbine {i_t} : {ueff} m/s')
Note: needs the "%" operator between string and inputs
Changed files:
relevant commit: e7ef2c820a127d4731a9c0c11254623ce054266c
A significant amount of the computational time required by OFF is dedicated to logging, even when logging is actually disabled.
Calls to logging using str.format() or string.Template syntax should ba avoided as they are executed even the logger is disabled. Passing the message arguments using the %-formatting enables postponing the formatting to the very last moment before the message is outputted via the handler. Therefore, the string interpretation won't be applied unless the logging level is sufficient enough.
lg.info(f'Hello {name} from logger!')
lg.info("Hello %s from logger!", name)
The calls to lg should therefore be corrected accordingly.