How to log Keras loss output to a file

When you run a Keras neural network model you might see something like this in the console: Epoch 1/3 6/1000 [..............................] - ETA: 7994s - loss: 5111.7661 As time goes on th...