Like if I’m using print statements to test my code. Is it okay to leave stuff like that in there when “publishing” the app/program?

Edit: So I meant logging. Not “tests”. Using console.log to see if the code is flowing properly. I’ll study up on debugging. Also, based on what I managed to grasp from your very helpful comments, it is not okay to do, but the severity of how much of an issue it is depends on the context? Either that or it’s completely avoidable in the first place if I just use “automated testing” or “loggers”.

  • xtrapoletariat@beehaw.org
    link
    fedilink
    arrow-up
    3
    ·
    14 days ago

    The question mixes up tests and logging. You are referring to logs.

    Use a good logging package. It will allow you to distinguish at least (possibly with verbosity levels)

    • trace
    • debug
    • information
    • warning
    • error

    In production, configure the log level to be info-level or above, everything below will be hidden.

    Lower levels can be useful for debugging automated tests. Possibly via a flag in production as well.

    • 3rr4tt1c@programming.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      12 days ago

      I honestly never realised the terminology was that important (so I never put much effort into remembering any of it). Yes I meant logging. I’m having trouble understanding the rest of what you mean though.