C++ Error Reporting Interface
<p>I'm designing an interface that can be used to report errors in C++. (I'm working with a legacy system where exceptions are out of question.) In my youthful naivety, I started along these lines while designing my API:</p>

<pre><code>bool DoStuff(int amount, string* error);
</code></pre>

<p>Return value signals success/failure, while <em>error</em> is used to report a human readable explanation. So far so good. Subroutine calls passed along the <em>error</em> pointer and everything was hunky-dory.</p>

<p>I ran into the following problems with this design (so far):</p>

<ol>
<li> Cannot report warnings.
<li> Not thread-safe.
</ol>

<p>Next, I decided to go with the following interface, instead of plain <em>string</em>:</p>

<pre><code>class Issues {
 public:
  void Error(const string&amp; message);
  void Warning(const string&amp; message);
  void Merge(const Issues&amp; issues);
}
</code></pre>

<p>So that I can change my API like this:</p>

<pre><code>bool DoStuff(int amount, Issues* issues);
</code></pre>

<p>I'm wondering, is there a more generic/standard API out there that deals with this problem? If yes, I'd like to take a look.</p>

<p><strong>UPDATE</strong>: I'm not looking for a logging library. For those who are curious, imagine you're writing a query engine that includes a compiler. The compiler issues warnings and errors, and those need to be returned to the user, as part of the response. Logging has its place in the design, but this is not it.</p>
