• Resolved DamirCalusic

    (@webkreativ)


    Hi,

    I would like to deactivate the log function but there are no settinsg in admin to disable/deactivate logging of Vipps in WooCommerce. Is is it possible to acheive this by any filter/action/hook?

    Best regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Iver Odin Kvello

    (@iverok)

    Vipps log messages uses the standard Woo log interface.

    You can create your own subclass of WC_Logger and return it via the filter ‘woocommerce_logging_class’. Any class that implements WC_Logger_Interface can be returned.

    There is also a filter ?'woocommerce_logger_log_message', ($message, $level, $context, $handler )

    if you check the $context here, all the Vipps messages will have ‘source’ ‘woo-vipps’. Return null for those and all logging should be turned off.

    Untested:

    add_filter('woocommerce_logger_log_message', function ($message, $level, $context, $handler ) {
        if (is_array($context) && isset($context['source']) && $context['source'] == 'woo-vipps') return null;
        return $message;
    }, 10, 4);
    Thread Starter DamirCalusic

    (@webkreativ)

    Hi,

    Thank you for a quick anser. I will test out the function and comeback with how it went.

    Thread Starter DamirCalusic

    (@webkreativ)

    Hi,

    I tried the function and modified and tested out some other variations but none works. Do you maybe have any other simple idea on how to manage this?

    Best regards.

    Plugin Author Iver Odin Kvello

    (@iverok)

    It’s really a woocommerce question, but fwiw this worked for me just now; placed in my child-themes functions.php:

    add_filter('woocommerce_logger_log_message' , function ($message, $level, $context, $handler )
     {   
         if (is_array($context) && isset($context['source']) && $context['source'] == 'woo-vipps') {
             return null;
         }
        return $message;
    }, 10, 4);

    Thread Starter DamirCalusic

    (@webkreativ)

    Hi,

    Thanks for fast answers. I willtest it out further to see what happens. When I tried earlier the log files were still being created and the database got alot of log data from woo-vipps.

    I will come back with how it went with my testing.

    Plugin Author Iver Odin Kvello

    (@iverok)

    If they are logged to the database, you probably have another plugin installed that might defeat the filters I mentioned. Normally Woo logs to files in the upload directory.

    Thread Starter DamirCalusic

    (@webkreativ)

    This has been fixed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Deactivate Log function’ is closed to new replies.