Lightweight 0.1.0
|
Represents a logger for SQL operations. More...
#include <SqlLogger.hpp>
Inherited by SqlLogger::Null.
Public Types | |
enum class | SupportBindLogging : uint8_t { No , Yes } |
Mandates the support for logging bind operations. More... | |
Public Member Functions | |
SqlLogger (SqlLogger const &)=default | |
SqlLogger (SqlLogger &&)=default | |
SqlLogger & | operator= (SqlLogger const &)=default |
SqlLogger & | operator= (SqlLogger &&)=default |
SqlLogger (SupportBindLogging supportBindLogging) | |
virtual void | OnWarning (std::string_view const &message)=0 |
Invoked on a warning. | |
virtual void | OnError (SqlError errorCode, std::source_location sourceLocation=std::source_location::current())=0 |
Invoked on ODBC SQL error occurred. | |
virtual void | OnError (SqlErrorInfo const &errorInfo, std::source_location sourceLocation=std::source_location::current())=0 |
Invoked an ODBC SQL error occurred, with extended error information. | |
virtual void | OnScopedTimerStart (std::string const &tag)=0 |
Invoked when a scoped code region needs to be timed and logged. The region starts with this call. | |
virtual void | OnScopedTimerStop (std::string const &tag)=0 |
Invoked when a scoped code region needs to be timed and logged. The region ends with this call. | |
virtual void | OnConnectionOpened (SqlConnection const &connection)=0 |
Invoked when a connection is opened. | |
virtual void | OnConnectionClosed (SqlConnection const &connection)=0 |
Invoked when a connection is closed. | |
virtual void | OnConnectionIdle (SqlConnection const &connection)=0 |
Invoked when a connection is idle. | |
virtual void | OnConnectionReuse (SqlConnection const &connection)=0 |
Invoked when a connection is reused. | |
virtual void | OnExecuteDirect (std::string_view const &query)=0 |
Invoked when a direct query is executed. | |
virtual void | OnPrepare (std::string_view const &query)=0 |
Invoked when a query is prepared. | |
template<typename T > | |
void | OnBindInputParameter (std::string_view const &name, T &&value) |
Invoked when an input parameter is bound. | |
virtual void | OnBind (std::string_view const &name, std::string value)=0 |
Invoked when an input parameter is bound, by name. | |
virtual void | OnExecute (std::string_view const &query)=0 |
Invoked when a prepared query is executed. | |
virtual void | OnExecuteBatch ()=0 |
Invoked when a batch of queries is executed. | |
virtual void | OnFetchRow ()=0 |
Invoked when a row is fetched. | |
virtual void | OnFetchEnd ()=0 |
Invoked when fetching is done. | |
Static Public Member Functions | |
static Null & | NullLogger () noexcept |
Retrieves a null logger that does nothing. | |
static SqlLogger & | StandardLogger () |
Retrieves a logger that logs to standard output. | |
static SqlLogger & | TraceLogger () |
Retrieves a logger that logs to the trace logger. | |
static SqlLogger & | GetLogger () |
Retrieves the currently configured logger. | |
static void | SetLogger (SqlLogger &logger) |
Represents a logger for SQL operations.
Definition at line 17 of file SqlLogger.hpp.
|
strong |
Mandates the support for logging bind operations.
Definition at line 21 of file SqlLogger.hpp.
|
inlineexplicit |
Constructs a new logger.
supportBindLogging | Indicates if the logger should support bind logging. |
Definition at line 37 of file SqlLogger.hpp.
|
inline |
Invoked when an input parameter is bound.
Definition at line 78 of file SqlLogger.hpp.
Referenced by SqlStatement::Execute().
|
static |
Sets the current logger.
The ownership of the logger is not transferred and remains with the caller.