Feb 12, 2013 (last update: Feb 13, 2013)

Simple console logger

Score: 3.8/5 (40 votes)
*****
As side product of the development of HGL (see here http://www.cplusplus.com/forum/lounge/91447/) I produced a simple but expandable console logger.

Simple to use:
1
2
3
4
#include "basiclogger.h"

logError("couldn't compress output");
logDebug("Details: " << e.what());

It supports log for following types:
  • std::wstring
  • std::string
  • std::exception
  • std::type_info
  • const std::string * - null safe
  • bool - text support, i.e. output as true/false
  • float
  • int
  • size_t
A note on std::type_info: if HAVE_GCC_ABI_DEMANGLE is defined and supported by the compiler, the name of the type will get demangled.

The logger is expandable by subclassing it. So new supported types can be introduced easily. I splitted it myself into the BasicLogger which is of common use and have subclasssed it for HGL specific logs.

Attached are all needed source files.

Attachments: [basiclogger.cpp] [basiclogger.h] [linkercontrol.h]