How to log in the middle of a pipeline?

Basically I have a couple of different use cases for executing a long running command, capturing the output, and doing something with the output:

some job:
  script:
    - some-long-command | tee /dev/tty | do-some-validation

This fails because there is no tty, so basically, is there any way that I could write the ‘host’ of the pipeline.

Workaround

this works in some cases, but I don’t want to have to write to a file when it shouldn’t be neccissary.

some job:
  script:
    - some-long-command | tee log.txt
    - do-some-validation < log.txt