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”.

  • 3rr4tt1c@programming.devOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 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.

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

      Apologies for being too cryptic/jargon. Pro tip: a real-life mentor can adapt to your level on-the-fly, if available.

      Maybe this introduction helps a bit to get an overview - from the context I expect you are on JavaScript or related.

      It’s often hard to grasp why packages or techniques exist unless you ran into the problems that motivated the solution yourself.

      In this case, it’s all about filtering by the severity of log messages (debug level). If the level is high, your app will show tiny bits of information. These do not need to show for every user, except if they want to enable it (via techniques like a switch/flag, environment variable or a config file).

      Config files or profiles are often used to enable/disable code parts in production or to configure how often scheduled jobs should be triggered and so on.

      Depending on your level of expertise logging stuff via the console may be just fine for the moment. In particular if you are the sole developer. Once you’re annoyed by your own logs, incrementally replace the ‘prints’ with a library that feels comfortable or well-documented.