_logger = $logger; $this->_varDirectory = $filesystem->getDirectoryWrite(DirectoryList::VAR_IMPORT_EXPORT); parent::__construct($data); } /** * Log debug data to file. * * Log file dir: var/log/import_export/%Y/%m/%d/%time%_%operation_type%_%entity_type%.log * * @param mixed $debugData * * @return $this */ public function addLogComment($debugData) { if (is_array($debugData)) { $this->_logTrace = array_merge($this->_logTrace, $debugData); } else { $this->_logTrace[] = $debugData; } if ($this->_debugMode) { $this->_logger->debug(var_export($debugData, true)); } return $this; } /** * Return human readable debug trace. * * @return string */ public function getFormatedLogTrace() { $trace = ''; $lineNumber = 1; foreach ($this->_logTrace as &$info) { $trace .= ($lineNumber++) . ': ' . $info . "\n"; } return $trace; } }