[PATCH v6 22/27] util: introduce common helper for error-report & log code