<p>Okay, I played around with it, and I agree that your solution is the more elegant one.  In fact I think that's what we tried first, but it still gives the mangled output at program exit.</p>

<p>I believe this is because the CLI singleton is getting deleted before the Log::Info objects.  There are maybe a couple things we can do here, including bypassing Log::Info for printing the timers and other information in <code>CLI::~CLI()</code> and just assembling the prefix string directly, or refactoring things such that the Log objects are guaranteed to be deleted after the CLI singleton.</p>

<p>I'm uncertain why the CLIDeleter solution even worked in light of this... why was the CLIDeleter object (which was also allocated on the heap as a global variable) consistently deleted after the four static Log objects, but this is not true for the CLI object?</p>

<p>Anyway, if you want to go ahead and remove CLIDeleter but come up with some way to still print the output correctly, I'd be more than happy to merge it.</p>

<p>(Sorry for the slow response.  Last week I didn't end up getting to this.)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/521#issuecomment-187446957">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFEilJwI-1UG7fECt6SGmo73C_4q4ks5pm5wegaJpZM4HX7Db.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/521#issuecomment-187446957"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>