Worthy of mentioning in connection with this thread is the bolded part below of Canon 21 from the Fourth Lateran Council:
"The priest shall be discerning and prudent, so that like a skilled doctor he may pour wine and oil over the wounds of the injured one. Let him carefully inquire about the circuмstances of both the sinner and the sin, so that he may prudently discern what sort of advice he ought to give and what remedy to apply, using various means to heal the sick person. Let him take the utmost care, however, not to betray the sinner at all by word or sign or in any other way. If the priest needs wise advice, let him seek it cautiously without any mention of the person concerned. For if anyone presumes to reveal a sin disclosed to him in confession, we decree that he is not only to be deposed from his priestly office but also to be confined to a strict monastery to do perpetual penance."