adding printLog and addLog functions