* @copyright 2020 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ if (!defined('_PS_VERSION_')) { exit; } /** * Class RetailcrmLogger * @author DIGITAL RETAIL TECHNOLOGIES SL * @license GPL * @link https://retailcrm.ru */ class RetailcrmLogger { /** * Write entry to log * * @param string $caller * @param string $message */ public static function writeCaller($caller, $message) { error_log( sprintf( '[%s] @ [%s] %s' . PHP_EOL, date(DATE_RFC3339), $caller, $message ), 3, static::getErrorLog() ); } /** * Write entry to log without caller name * * @param string $message */ public static function writeNoCaller($message) { error_log( sprintf( '[%s] %s' . PHP_EOL, date(DATE_RFC3339), $message ), 3, static::getErrorLog() ); } /** * Write debug log record * * @param string $caller * @param mixed $message */ public static function writeDebug($caller, $message) { if (RetailcrmTools::isDebug()) { static::writeNoCaller(sprintf( '(DEBUG) <%s> %s', $caller, print_r($message, true) )); } } /** * Returns error log path * * @return string */ protected static function getErrorLog() { if (!defined('_PS_ROOT_DIR_')) { return ''; } return _PS_ROOT_DIR_ . '/retailcrm.log'; } }