This に is a particle explained here: What does the に do in 表情から察するに? This は is a topic marker and is optional here.
This type of に is literary and used mainly in written Japanese. It attaches to only a small group of verbs (言う, 見る, 聞く, 思う, 考える, 察する, etc.) in modern Japanese, so I think it's okay to think of them as just a group of similar set phrases. (It used to beIn classical Japanese, it was a simple conjugationconjunctive particle similar to と in classical Japanese.)