Use a thread-safe static inline function for printing