Skip to content
Snippets Groups Projects

Release 0.2.0

Closed Timm Fitschen requested to merge release-0.2.0 into main
10 files
+ 159
87
Compare changes
  • Side-by-side
  • Inline

Files

@@ -42,6 +42,26 @@ typedef boost::log::sources::severity_channel_logger_mt<int, std::string> boost_
BOOST_LOG_GLOBAL_LOGGER(logger, boost_logger_class)
/**
* Helper class for logging the entering and leaving of a function or method.
*
* Please Use the macro
*
* CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, function_name);
*/
class TraceEnterLeaveLogger {
public:
inline TraceEnterLeaveLogger(const std::string &channel, const std::string &function_name) : channel(channel), function_name(function_name) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), this->channel, CAOSDB_LOG_LEVEL_TRACE) << "Enter " << this->function_name;
}
inline ~TraceEnterLeaveLogger() {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), this->channel, CAOSDB_LOG_LEVEL_TRACE) << "Leave " << this->function_name;
}
private:
const std::string &channel;
const std::string function_name;
};
/**
* This class stores the integer log level.
*/
@@ -199,6 +219,9 @@ void caosdb_log_trace(const char *channel, const char *msg);
#define CAOSDB_LOG_TRACE(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_TRACE)
#define CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(Channel, FunctionName) \
const caosdb::logging::TraceEnterLeaveLogger trace_enter_leave_logger(Channel, FunctionName);
#define CAOSDB_LOG_ERROR_AND_RETURN_STATUS(Channel, StatusCode, Message) \
CAOSDB_LOG_ERROR(Channel) << "StatusCode (" << StatusCode << ") " \
<< caosdb::get_status_description(StatusCode) << ": " << Message; \
Loading