Weightloss, for me is largely about context and perspective. There's the physical aspect of course; what you're consuming, exercise regimen, where you are in your journey etc.
However, putting those points aside for a moment, my framework for weightloss comes down to context and perspective. How you process and interpret the inputs you're receiving is important within the overarching principles of your weightloss journey.
Your journey will doubtless contain many Valleys and peaks, it's the nature of the process. How you approach these highs and lows and how they fit within your framework is crucial to success.
As an example, you record a weight gain, what does that mean? were there genuine factors at play? are you prone to water retention or was it a slip? If it was a slip, was it minor or a regression to old habits?
Understanding the context (how it occurred) and the perspective (what value do you attach, if any) will help you process what's happened and choose how it fits within your framework. Is it an anomaly, a reaction or a sign of a deeper, larger issue.
Processing the highs and lows through context and perspective will enable you to maintain a more even handed, phlegmatic approach to weight loss and hopefully avoid derailment before it occurs.
A weight gain is no more reason to abandon the process than a weight loss is to overreact in celebration.
As I said, for me it comes down to context and perspective.