Creation, reading and writing of log files

How to create, read and write log file in pytorch?