I think I will program the ESP with the Arduino IDE to act as a serial-to-wifi gateway, or look if there aren't already any sketches available (probably are). The goal is to send configuration parameters (SSID, password, remote server etc) from the Teensy through the UART to the ESP and save them there. Then put the ESP and Teensy in sleep mode. The Teensy wakes up from time to time to gather samples, and every once in a while it also wakes the ESP up and sends the data through the uart to the ESP, which posts it to the remote server. This is the standard approach to wireless datalogging, so I'm certain there will be a lot of examples out on the internet.