use function instead of macros for logging to make generated code smaller