write the logger library (open a file, write logs of the data, close the file on thread cancel or error, etc)