On the authority of Usamaah ibn Shareek radiallahu anhu that the Prophet sallahu alayhi wa salam said:
ما كرهتَ أن يراهُ الناسُ فلا تفعلهُ إذا خلوتَ
“Whatever you dislike that people see from you, then do not do it when you are alone”
[Graded Hasan by al-Albani in Saheeh Jami no. 5659]
Imam al-Munaawi rahimahullah said:
أي كنت في خلوة بحيث لا يراك إلا الله تعالى والحفظة وهذا ضابط وميزان
“That is: you are alone such that none can see you except Allah and the Angels who record. This is the principle and the scale [to measure yourself or remind yourself of]”
[Fayd ul-Qadeer Sharh Jami as-Sagheer]
So this Hadith teaches us to remind ourselves not to do in private what we would dislike anyone seeing from us in public. Likewise, that Allah is always observing us as He, the Exalted said:
إِنَّ اللَّهَ كَانَ عَلَيْكُمْ رَقِيباً
Surely, Allah is always watching over you
[4:1]