Exactly how you did.
Calling out a trainer in front of clients can be a big no-no, it breaks down the atmosphere of the gym. Keeping them as “professionals” is especially important and the image they represent can be injured when others see a social breakdown in the workplace.
Talking to them in private was a good call on your part- but maybe ask the trainer what they were working on. A big part of being a trainer is maintaining open communication with clients. Granted they should focus on who they are currently with but allow them some leniency to network.
I do it every now and then because I may need to reschedule with someone, but I keep the texting strictly professional. All of my personal texts wait till after work.