How to pass a variable to a stored procedure?
There are no global variables in PostgreSQL, sou you'd have to pass d_setlog as parameter to the procedure.

An alternative is to use a custom placeholder parameter in PostgreSQL:

The calling function does

SET mylog.active = true;


and the called procedure tests

IF current_setting('mylog.active', TRUE) = 'true' THEN ...


Note that such parameters are always strings.