Use Flask logger instead of printing