Export logs while training


How do I save logs with training and validation metrics while training the model?

I’m using the Trainer class. I can see the training logs while training the model and save them all in the desired format when training is finished. But I can’t export the logs during training.

maybe something like,

import logging
logger = logging.getLogger()

could solve this problem, could export the logs to the file using the logger