add function write or read log from sqlite3 database