improve error logging API