]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store.cpp
Introduced logger for plugins.
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store.cpp
index 4bf72c0e951f051b904768f643d07833c4b29d56..7c79baff6b6df487391136caf3356d9f94db4b11 100644 (file)
 
 #include <libpq-fe.h>
 
-#include "postgresql_store.h"
-#include "postgresql_store_utils.h"
 #include "stg/module_settings.h"
+#include "stg/plugin_creator.h"
+#include "postgresql_store_utils.h"
+#include "postgresql_store.h"
 
-class POSTGRESQL_STORE_CREATOR
-{
-public:
-    POSTGRESQL_STORE_CREATOR()
-        : pqStore(new POSTGRESQL_STORE())
-        {
-        };
-    ~POSTGRESQL_STORE_CREATOR()
-        {
-        delete pqStore;
-        };
-    POSTGRESQL_STORE * GetStore() { return pqStore; };
-private:
-    POSTGRESQL_STORE * pqStore;
-} pqStoreeCreator;
+PLUGIN_CREATOR<POSTGRESQL_STORE> pqStoreeCreator;
 
 //-----------------------------------------------------------------------------
 STORE * GetStore()
 {
-return pqStoreeCreator.GetStore();
+return pqStoreeCreator.GetPlugin();
 }
 
 //-----------------------------------------------------------------------------
 POSTGRESQL_STORE::POSTGRESQL_STORE()
     : versionString("postgresql_store v.1.3"),
+      strError(),
       server("localhost"),
       database("stargazer"),
       user("stg"),
       password("123456"),
+      clientEncoding("KOI8"),
+      settings(),
+      mutex(),
       version(0),
+      retries(3),
       connection(NULL),
-      retries(3)
+      logger(GetPluginLogger(GetStgLogger(), "store_postgresql"))
 {
 pthread_mutex_init(&mutex, NULL);
 }