A rhodamine-based optical probe has been designed through a one-pot synthetic protocol involving phenanthroline as a binding motif. The compound showed a bright pink coloration specifically upon the addition of Cu2+ and Hg2+ ions. However, the appearance of bright red fluorescence was observed only in the presence of Hg2+. Considering both, we can detect and discriminate these two ions even at ppb level concentration. Furthermore, these in situ generated metal complexes were utilized for the selective recognition of CN- and I- ions. Pre-coated TLC plates were developed for rapid on-site detection of these toxic ions even in remote places. Finally, on a single molecular probe based on differential opto-chemical interactions with different ions (Cu2+, Hg2+, CN- and I-), we were able to design numerous trivial (OR, NOR) and non-trivial (INHIBIT, IMPLICATION, COMPLEMENT, TRANSFER, NOT-TRANSFER) logic gates. Most fascinatingly, we can switch the logic response from one type to another by simply tuning only the optical output channel.