If you have awk you can do:
awk '/foo/{print b$0;b="";x=1;next} x{b=b$0"\n"}' bar.log | less
It buffers all lines since last occurence ofWhen a foo inappears, it prints buffer (b variable) and current line, and clears the buffer.
Otherwise, but only if foo already appeared (x variable) it buffers current line.