On the other hand, if you model productive negative thinking and communication, people will be relieved that they have the space to express their problems, and you will accelerate genuine team bonding and psychological safety.
I have success stories from my personal experience doing this.
I think some big things to consider is what the negativity is trying to accomplish, how is it presented, and is any solution presented?
Is there vindictiveness in the negativity? resentment? superiority? smugness? irritation? is it directed at a person, a process, a project?
Is the negativity being brought up just for the sake of complaining? to solicit empathy or solidarity?
Is the negativity specific? actionable?
Those may be valid feelings, and great things to examine...and then probably keep to yourself, and find productive ways to either soothe/cope or change the environment/root causes.
I say this as someone that endeavors to do what you've described in your initial post, but also as someone that struggles with adhd/depression, keeping it to myself can be it's own struggle. And then I worry that I've rained on my coworkers parade, or that I've worsened their work environment.
People have something of a battery when it comes to this sort of thing, and it can definitely be drained, so it's important to be conscientious of that.
Mindfulness exercises and meditation help me a great deal with all of the above, by doing what you suggest, and being inquisitive about the feelings. And also being aware of how the body is behaving during those feelings.
I have success stories from my personal experience doing this.