logg errors properly