This can be difficult to answer, but I'll try from a US/FAA perspective.
If you want to become a military pilot you cannot have any history of mental or psychological disorder This is from the perspective of starting out to become a military pilot. If you are already a military pilot and have some kind of mental/psychological issue that you need addressed, there is a process for doing that and returning to service. From this standpoint, self-help and "keeping it to yourself" is better than seeking treatment since you will be disqualified outright.
How do I know this? This is exactly what happened to me. I had seen a psychologist when I was 8 or 9 years old (because he was a quack and convinced my mother (who was being treated for depression) that I needed help too). This made it into my permanent medical record. I applied for military service with the US Marines during college with the goal of becoming a pilot. I took the Air-Force Officers Qualifying Test (AFOQT) and passed with a 98% (the highest my recruiter had ever encountered). When it came time for my MEPS review they found the history (I disclosed it at the beginning, they found it via my disclosure and I provided additional documentation when asked) and disqualified me. I appealed to the review board and was denied. I appealed again, denied, and you only get two appeals (and the only recourse after that would be a Congressional/Presidental appointment). They told me I was eligible to enlist, but not eligible to be an officer.
FAA Medical Perspective
The FAA takes a different stance in that you are required to disclose to the AME any mental health visits during the previous three years. The AME will then decide if it warrants additional testing or review by the Office of Aeronautical Medicine (OAM). The FAA can also get this information via other methods (for example if your employer reported you or you are jailed for some kind of mental health disorder outburst).
Certain conditions are automatically disqualifying, such as psychosis, bipolar disorder, and severe personality disorder.
There are laws in the US protecting employees from being discriminated against for mental health issues. Many companies have reporting and monitoring programs that assist a pilot with a psychological issue to seek help and get back to flying. The FAA participates in these programs and provides a "rigorous evaluation" before allowing the pilot to return to flying.
So from a commercial service perspective it is important to be open about the issues upfront and early, especially with your AME. Pilots have been arrested for denying mental health history.