Decoupling output in Symfony command line
<blockquote>
  <p>Note: I refer to the Symfony Console component quite a lot in my question, but I think this question could be considered broader if thought about in the context of any user interface.</p>
</blockquote>

<p>I am using the <code>Symfony Console component</code> to create a console application. I am trying to keep class coupling to a minimum, as it makes unit testing easier and is generally better practice.</p>

<p>My app has some processes which may take some time to complete, so I want to keep the user informed as to what is happening using progress bars and general text output as it runs. Symfony requires an instance of the <code>Symfony</code> Console OutputInterface to be passed to any command's execute method. So far so good; I can create progress bars and output text as I please. However, all of the heavy lifting of my app doesn't happen in the commands' execute methods and is instead within the core classes of my application. These classes shouldn't and don't know they are being used in a console application.</p>

<p>I am struggling to keep it this way because I don't know how to provide feedback to the console (or whatever user interface) without injecting the output class into my core. Doing so would result in tight coupling between the console output class and my application core. I have thought about using an event dispatcher (Symfony has one), but that too means my core will be coupled with the dispatcher (maybe that's fine). Ideally, I need to sort of "bubble" my application state back up to the execute method of the invoked command, where I can then perform output.</p>

<p>Could someone point me in the right direction, please? I feel like this must actually be quite a common case but can't find much about it.</p>

<p>Thanks for your time in advance!</p>