All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AppenderDB Class Reference

#include <AppenderDB.h>

Public Types

typedef std::integral_constant
< AppenderType, APPENDER_DB >

Public Member Functions

 AppenderDB (uint8 id, std::string const &name, LogLevel level, AppenderFlags flags, ExtraAppenderArgs extraArgs)
 ~AppenderDB ()
void setRealmId (uint32 realmId) override
AppenderType getType () const override
- Public Member Functions inherited from Appender
 Appender (uint8 _id, std::string const &name, LogLevel level=LOG_LEVEL_DISABLED, AppenderFlags flags=APPENDER_FLAGS_NONE)
virtual ~Appender ()
uint8 getId () const
std::string constgetName () const
LogLevel getLogLevel () const
AppenderFlags getFlags () const
void setLogLevel (LogLevel)
void write (LogMessage *message)

Private Member Functions

void _write (LogMessage const *message) override

Private Attributes

uint32 realmId
bool enabled

Additional Inherited Members

- Static Public Member Functions inherited from Appender
static const char * getLogLevelString (LogLevel level)

Member Typedef Documentation

typedef std::integral_constant<AppenderType, APPENDER_DB>::type AppenderDB::TypeIndex

Constructor & Destructor Documentation

AppenderDB::AppenderDB ( uint8  id,
std::string const name,
LogLevel  level,
AppenderFlags  flags,
ExtraAppenderArgs  extraArgs 
22  : Appender(id, name, level), realmId(0), enabled(false) { }
uint32 realmId
Definition: AppenderDB.h:35
std::string name
Definition: Appender.h:109
bool enabled
Definition: AppenderDB.h:36
Appender(uint8 _id, std::string const &name, LogLevel level=LOG_LEVEL_DISABLED, AppenderFlags flags=APPENDER_FLAGS_NONE)
Definition: Appender.cpp:40
LogLevel level
Definition: Appender.h:110
AppenderDB::~AppenderDB ( )
24 { }

Member Function Documentation

void AppenderDB::_write ( LogMessage const message)

Implements Appender.

27 {
28  // Avoid infinite loop, PExecute triggers Logging with "sql.sql" type
29  if (!enabled || (message->type.find("sql") != std::string::npos))
30  return;
33  stmt->setUInt64(0, message->mtime);
34  stmt->setUInt32(1, realmId);
35  stmt->setString(2, message->type);
36  stmt->setUInt8(3, uint8(message->level));
37  stmt->setString(4, message->text);
38  LoginDatabase.Execute(stmt);
39 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 realmId
Definition: AppenderDB.h:35
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: LoginDatabase.h:65
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
bool enabled
Definition: AppenderDB.h:36
uint8_t uint8
Definition: g3dmath.h:164
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124

+ Here is the call graph for this function:

AppenderType AppenderDB::getType ( ) const

Implements Appender.

32 { return TypeIndex::value; }
const FieldDescriptor value
Definition: descriptor.h:1522
void AppenderDB::setRealmId ( uint32  realmId)

Reimplemented from Appender.

42 {
43  enabled = true;
44  realmId = _realmId;
45 }
uint32 realmId
Definition: AppenderDB.h:35
bool enabled
Definition: AppenderDB.h:36

Member Data Documentation

bool AppenderDB::enabled
uint32 AppenderDB::realmId

The documentation for this class was generated from the following files: