Skip to content

Latest commit

 

History

History
122 lines (89 loc) · 1.64 KB

File metadata and controls

122 lines (89 loc) · 1.64 KB

< Differences

Before and after: Debug logging

Turning on debug logging got slightly more complicated is also much more flexible.

sqlpp11sqlpp23

Turn off logging

config->debug = false;
config->debug = {};

Turn on logging (all messages to stderr)

config->debug = true;
constexpr auto log_cerr =
    [](const std::string& message) {
      std::cerr << message << '\n';
    };

// ...

config->debug = sqlpp::debug_logger{
    {sqlpp::log_category::all},
    log_cerr};

Turn on logging (some messages to clog)

// Not possible.
constexpr auto log_clog =
    [](const std::string& message) {
      std::clog << message << '\n';
    };

// ...

// Log messages about statements and their
// parameters to std::clog.
config->debug = sqlpp::debug_logger{
    {sqlpp::log_category::statement,
     sqlpp::log_category::parameter},
    log_clog};

Turn off logging at compile time

// Not possible.
// Before including sqlpp23/core/debug_logger.h in
// the current compilation unit.
#define SQLPP23_DISABLE_DEBUG

< Differences