/** * Save log message * * @param int $action * @param Product $product * @param int $type * @param string $message * @param null|string $code * @return int|false */ protected static function log($action, Product $product, $type, $message, $code = null) { $message = trim($message); $template = $product->getTemplate(); $data = array('product_id' => $product->id, 'template_id' => $product->template_id, 'product_name' => $product->original_title, 'template_name' => $template ? $template->name : '-', 'message' => $message, 'code' => $code, 'action' => $action, 'type' => $type, 'datetime' => time()); return db_query('INSERT INTO ?:ebay_product_log ?e', $data); }