I have some related changes (that i pushed to a new branch "new_logger").
1.
there has been some minor problems with printing errors. A sideeffect of having to many macros and it's hard to know which one to use.
2.
having to type out the classname or function name is just awful. They are often wrong (copy-paste mistakes).
I modified the macros and logger to pretty-print that automatically.
3.
the "error" and "warning" functions was duplicating a lot of code unnecessarily.
Also required a maximum error length (though it was very generous).
I have extracted the unique part of those functions and replaced with a much simpler function (that is the pretty-printed function name).
I call this new function "errorInfo" and it's used for both error and warnings. I implemented it in a few classes that where missing it.
4.
_error and _warning is very unsafe as MACRO names. We should stick to namespaced names like OOFEM_ERROR.
5.
_proc is no longer needed either. All compilers have at least some macro that defines the function name. C99 dictates __func__, which MSVC ignores, but they have __FUNCTION__ instead.
We might need to add another #ifdef-check there, but it should be safe to assume that we can easily fix that.
Now there are 2 sets of macros in error.h
E.g.
OOFEM_ERROR <-- Now the most expressive version. Use if possible.
and
OOFEM_SIMPLE_ERROR <-- For C code and things that doesn't have classes. Use if OOFEM_ERROR won't work there.
I chose the shorter name for the one that uses "errorInfo", since it is much much more common.
This change was massive, simple due to there being so very many OOFEM_ERROR* and WARNING calls in the code already, but almost all of it are trivial 1 line changes.
I put them in a new branch anyway, it's called "new_logger".
Example of output:
Code:
OOFEM_ERROR("Some message here");
Output:
_______________________________________________________
Error: (/home/micket/projects/oofem/src/sm/linearstatic.C:296)
In LinearStatic::solveYourselfAt:
Some message here
_______________________________________________________
Code:
OOFEM_SIMPLE_ERROR("Some message here");
Output:
_______________________________________________________
Error: (/home/micket/projects/oofem/src/sm/linearstatic.C:296)
In solveYourselfAt:
Some message here
_______________________________________________________