Logging api - addresses issue #771 (#775)
* Added a basic logger object and relevant macros. * Modify logging macros for more flexibility. Supplied logger types and sample values using macros for flexibility in recompiling the library against a different logging engine - the macros can be redefined to make calls to the relevant functions. * Updated endpoint and listener to use new logging structure. It remains to update the SSL portions of listener.cc to output SSL errors via the new loggers. * Add error logging for SSL errors in listener.cc. This needed an extension to the RAII setup for SSL objects to handle BIO objects. Also modified some exception types to ensure they get caught and logged by existing code. Moved anonymous function definitions to the top of listener.cc so that they are available in the entire file. These changes don't significantly change the behaviour of the Pistache library - it still logs errors and throws an exception for most errors that occur internally. It would likely be more sensible to only throw a descriptive exception and not log if the exception is expected to be handled by the library user - this gives them better control of the output of the software. Logging could be reserved for tracking events and debug; when the user is not expected to provide input. * Renamed macros and types to "string logger" and similar. This aligns the names of the types and macros, as well as leaving space for future logging APIs that handle different message types.
Showing
include/pistache/log.h
0 → 100644
src/common/log.cc
0 → 100644
tests/logger_test.cc
0 → 100644
Please register or sign in to comment