X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8569ecdc2c9368dc0fe650b901cce7b37337ffec..ee882f766d3173ed8ffb6e52b06749c10832f1bf:/stglibs/logger.lib/include/stg/logger.h?ds=sidebyside

diff --git a/stglibs/logger.lib/include/stg/logger.h b/stglibs/logger.lib/include/stg/logger.h
index c55801ac..e8d625a0 100644
--- a/stglibs/logger.lib/include/stg/logger.h
+++ b/stglibs/logger.lib/include/stg/logger.h
@@ -30,6 +30,7 @@ public:
     ~STG_LOGGER();
     void SetLogFileName(const std::string & fn);
     void operator()(const char * fmt, ...) const;
+    void operator()(const std::string & line) const { LogString(line.c_str()); }
 
 private:
     STG_LOGGER();
@@ -37,22 +38,25 @@ private:
     STG_LOGGER & operator=(const STG_LOGGER & rvalue);
 
     const char * LogDate(time_t t) const;
+    void LogString(const char * str) const;
 
     std::string fileName;
     mutable pthread_mutex_t mutex;
 };
 //-----------------------------------------------------------------------------
-class PLUGIN_LOGGER : private STG_LOGGER
+class PLUGIN_LOGGER
 {
-friend PLUGIN_LOGGER GetPluginLogger(const STG_LOGGER & logger, const std::string & pluginName);
+friend PLUGIN_LOGGER GetPluginLogger(const STG_LOGGER& logger, const std::string& pluginName);
 
 public:
-    PLUGIN_LOGGER(const PLUGIN_LOGGER & rhs);
-    void operator()(const char * fmt, ...) const;
+    PLUGIN_LOGGER(const PLUGIN_LOGGER& rhs) : m_parent(rhs.m_parent), m_pluginName(rhs.m_pluginName) {}
+    void operator()(const char* fmt, ...) const;
+    void operator()(const std::string& line) const;
 
 private:
     PLUGIN_LOGGER(const STG_LOGGER & logger, const std::string & pn);
-    std::string pluginName;
+    const STG_LOGGER& m_parent;
+    std::string m_pluginName;
 };
 
 PLUGIN_LOGGER GetPluginLogger(const STG_LOGGER & logger, const std::string & pluginName);