That is leaf miner damage.
I usually don't have this pest, but I did before I went on strike against it. I pretty much did what was described below. To control the adults, I used neem oil.
The leaf miners do not affect the fruit quality unless the infestation is very bad. The tomatoes are entirely safe to eat.
I found some very good advice on prevention and control, from here:
- Monitor plant leaves closely. At the first sign of tunneling, squeeze the leaf at the tunnel between two fingers to crush any larvae. Done soon enough, this killing larvae can allow plants to survive minor outbreaks. Pick off and destroy badly infested leaves in small gardens.
- The more healthy the plant, the less chance that leafminers will hurt it. Maintain plant health with organic fertilizers and proper watering to allow plants to outgrow and tolerate pest damage. Keep your soil alive by using compost and other soil amendments.
- Use floating row covers to prevent fly stage from laying eggs on leaves.
- The parasitic wasp Diglyphus isaea is a commercially available beneficial insect that will kill leafminer larva in the mine. The wasp is especially beneficial to indoor growers of ornamentals and vegetables.
- Use yellow sticky traps to catch egg laying adults. Cover soil under infested plants with plastic mulches to prevent larvae from reaching the ground and pupating.
- Organic neem oil will break the pests’ life-cycle by preventing larva from reaching maturity. Neem oil may also have repellent qualities and interfere with egg laying activities.
- Botanical insecticides can be used to knock down adult insects but have little effect on the protected larval stage feeding inside the leaf.