Improve message logging