function TPLog($order = null, $user = null, $endpoint = null)
{
    $logger = new TodoPagoLogger();
    $logger->setPhpVersion(phpversion());
    $logger->setCommerceVersion(VERSION);
    $logger->setPluginVersion("1.3.1");
    $payment = false;
    if ($order != null) {
        $payment = true;
    }
    if ($payment) {
        $logger->setEndPoint($endpoint);
        $logger->setCustomer($user);
        $logger->setOrder($order);
    }
    $logger->setLevels("debug", "fatal");
    $logger->setFile(dirname(__FILE__) . "/todopago.log");
    return $logger->getLogger($payment);
}
예제 #2
0
 public static function createLogger($payment = false, $mode = null, $customer = null, $order = null)
 {
     $logger = new TodoPagoLogger();
     $logger->setFile(TP_LOGDIR);
     $logger->setPhpVersion(phpversion());
     $logger->setCommerceVersion(VERSION);
     $logger->setPluginVersion(TP_VERSION);
     $logger->setLevels(TP_LOGLEVEL, 'fatal');
     if ($payment) {
         $endpoint = $mode == 'prod' ? "TODOPAGO_ENDPOINT_PROD" : "TODOPAGO_ENDPOINT_TEST";
         $logger->setEndPoint($endpoint);
         $logger->setCustomer($customer);
         $logger->setOrder($order);
     }
     try {
         return $logger->getLogger($payment);
     } catch (Exception $e) {
         $return = $logger->getLogger(false);
         $return->warn("Ha ocurrido un error creando el logger", $e);
         return $return;
     }
 }
예제 #3
0
 public function configureLog()
 {
     $cart = $this->context->cart;
     $endpoint = $this->getModo() ? "TODOPAGO_ENDPOINT_PROD" : "TODOPAGO_ENDPOINT_TEST";
     $logger = new TodoPagoLogger();
     $logger->setPhpVersion(phpversion());
     $logger->setCommerceVersion(_PS_VERSION_);
     $logger->setPluginVersion($this->version);
     $payment = false;
     if ($cart != null) {
         if ($cart->id != null) {
             $payment = true;
         }
     }
     if ($payment) {
         $logger->setEndPoint($endpoint);
         $logger->setCustomer($cart->id_customer);
         $logger->setOrder($cart->id);
     }
     $logger->setLevels("debug", "fatal");
     $logger->setFile(dirname(__FILE__) . "/todopago.log");
     return $logger->getLogger($payment);
 }