add writeLog method