improved message logging