U
U
Urukhayy2017-10-25 10:45:21
Node.js
Urukhayy, 2017-10-25 10:45:21

Is logging errors to a file in a web application a normal practice?

Node. For convenient detection of bugs, I want to impose logging on most conditional operators, in case of a false check.
For example:

if(name != undefined ) // call function
else log.write("ERROR: Пришло пустое имя")

Is this normal practice? What would you recommend for logging?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2017-10-25
@FanatPHP

Logging errors in general is absolutely normal.
Checking each comma for errors by hand is absolutely not normal.
The program should say what it does, not how it logs every sneeze. It will be impossible to read such a program.
I don’t know how it is in a node, but in PHP the engine itself is able to find errors in the code and log them without the participation of a programmer. That is, we simply write a call function, and PHP itself sees that the argument is not defined, and writes about it to the log.
The code is MUCH shorter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question