Moved error related functions to log_err.c