Added messages to a logger instead of printing them.