• mb00

    (@mb00)


    Currently there is a lot of console.log spam produce by Klarna Payments for WooCommerce. While this might be useful for debugging, console.log() has no place in production environments.

    Consider the following options:

    1. Pass a variable using wp_localize_script() and then ether have a wrapper function for console.log() or do something like window.yourCustomObjectName.debug && console.log( ‘your message’ );
    2. Ship two js versions with and without debugging code, e.g. klarna-payments.js and klarna-payments.debug.js and then have setting to choose between those two options. While at it offer a minified javascript option as well.
    3. Strip debug code before release.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support louisekrokedil

    (@louisekrokedil)

    Hi,

    Could you please send what spam message it is? Is it related to textdomain?

    Thread Starter mb00

    (@mb00)

    It’s not related to text domain. console.log() is a JS function, it’s been triggered when payment method is changed:

    #klarna_payments_pay_over_time_container
    klarna_payments_pay_over_time
    klarna_payments_pay_over_time

    There is 27 places where this function is called in 6 different JS files.

    • This reply was modified 3 months ago by mb00.
    Plugin Support louisekrokedil

    (@louisekrokedil)

    Hi @mb00,

    Sorry for our late reply. This is not an error, these messages are for debugging purposes. I have created an internal task for us to discuss whether it is possible to hide these messages.

    Thread Starter mb00

    (@mb00)

    I’m aware these are not error messages, but it has no place in production environment without option to opt out. This technically should be opt-in, not an opt-out as well.

    I’ve listed multiple options how to address this in my first comment. It’s not very complicated.

    Plugin Support louisekrokedil

    (@louisekrokedil)

    Hi @mb00 ,

    Thanks for letting us know, i have mentioned your options on how to address this in our internal task and we will look at this further when time permits.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.