Error Logging — Linking Computer Science Principles with how to deal with Depression + Anxiety
“The rear view mirror is smaller, because of where you have been, you’re only supposed to look at it for a little. Because where you’re going is a lot greater”
So… how many of you have added print statements to your code to try to figure out why it’s failing?
What Does Error Logging Mean?
In computer science, an error log is a record of critical errors that are encountered by the application, operating system or server while in operation. Some of the common entries in an error log include some type of configuration corruption. Error logs in many cases serve as extremely useful tools for troubleshooting and managing systems, servers, software architectural infrastructures, and networks.
An example of logging looks like this:
import logging
logging.basicConfig(filename=’app.log’, filemode=’w’, format=’%(name)s — %(levelname)s — %(message)s’)
logging.warning(‘This will get logged to a file’)
In a clear way, logging is just a fancy way to define a process of writing down everything you do.
Useful logs can provide the developer (especially when someone has to debug/maintain someone else’s code) with tremendous help when trying to understand what the code actually does.
Some developers say that stack trace is all someone should ever need, but that could not be further from the truth. Stack traces are great and can tell you where and what went wrong, but they can’t tell you how you got there in the first place. Surely you can follow execution through break points but, going in blind will make the whole process a lot more time-consuming than it actually should, and could be.
So, how does this link to mental health?
The tragic play of depression and/or anxiety
In a depressed state, people typically:
- Draw within themselves
- Ruminating on what plagues them
- Reflect upon how bad they feel
Ruminations typically centre on personal problems, self-criticism, self-blame, helplessness, hopelessness, worthlessness, pessimism, and related states such as anxiety, shame, guilt, and anger.
These depressing thoughts feel real, but they represent a distorted reality. For example, when you tell yourself that you will “never” get better, or you will “always” stay depressed, you make an overgeneralisation. That’s a distortion.
If you feel depressed, it can seem like a forever proposition. But what happens when you break from depression, or go through a non-depressed period? How does “never” or “always” work then?
So what would happen if you approached life with an empirical, problem-solving mentality such as error logging?
Use of this empirical method
Implementing the practice to log your thoughts, such as when you feel tense, is one practical problem-solving solution that you can do,
This helps make depressive or anxious thinking visible and vulnerable.
Through the development of practical knowledge, and by engaging in practical actions, you can interrupt the flow of negative beliefs, alter depression-laden behaviours, and engage in higher level positive awarenesses and actions.
Empirical problem-solving solutions involve working as a scientist, where you use observations and knowledge to connect the dots between depressing situations, thoughts, emotions, and consequences. The process involves the application of reason and scientific ways of knowing to cope with depression. Through this process, you train yourself to see depressive premonitions as testable hypotheses, as opposed to absolute truths. For example, if you think that your future is always going to be bleak, define this as a hypothesis. Then look for exceptions to contest this view.
At the level of core problem-solving solutions, you dig deeper. You examine your personal views of yourself, your level of tolerance for frustration, your perspective, the themes that characterise your life, and your beliefs, values, and personal philosophies. Core problem-solving includes examining your beliefs, revising those that are irrational, and reinforcing those that are fact-based and constructive.
My personal journey with recovering from depression:
As much as I hated it, I unfortunately had to start journaling. With going through depression, your mood fluctuates a lot.
With logging my thoughts, I am able to identify my triggers, understand how and what makes my emotions fluctuate during the day, and understand better what action plan to take towards the journey of my recovery.
Just like programming, adding log statements to your life as a way to debug, is a skill to learn. The process of retracing and reconfiguring your thoughts can do wonders in the long term.