9 STG_LOGGER & GetStgLogger();
10 //-----------------------------------------------------------------------------
11 class STG_LOGGER_LOCKER
14 explicit STG_LOGGER_LOCKER(pthread_mutex_t * m) : mutex(m) { pthread_mutex_lock(mutex); }
15 ~STG_LOGGER_LOCKER() { pthread_mutex_unlock(mutex); }
18 STG_LOGGER_LOCKER(const STG_LOGGER_LOCKER & rvalue);
19 STG_LOGGER_LOCKER & operator=(const STG_LOGGER_LOCKER & rvalue);
21 pthread_mutex_t * mutex;
23 //-----------------------------------------------------------------------------
26 friend STG_LOGGER & GetStgLogger();
27 friend class PLUGIN_LOGGER;
31 void SetLogFileName(const std::string & fn);
32 void operator()(const char * fmt, ...) const;
33 void operator()(const std::string & line) const { LogString(line.c_str()); }
37 STG_LOGGER(const STG_LOGGER & rvalue);
38 STG_LOGGER & operator=(const STG_LOGGER & rvalue);
40 const char * LogDate(time_t t) const;
41 void LogString(const char * str) const;
44 mutable pthread_mutex_t mutex;
46 //-----------------------------------------------------------------------------
49 friend PLUGIN_LOGGER GetPluginLogger(const STG_LOGGER& logger, const std::string& pluginName);
52 PLUGIN_LOGGER(const PLUGIN_LOGGER& rhs) : m_parent(rhs.m_parent), m_pluginName(rhs.m_pluginName) {}
53 void operator()(const char* fmt, ...) const;
54 void operator()(const std::string& line) const;
57 PLUGIN_LOGGER(const STG_LOGGER & logger, const std::string & pn);
58 const STG_LOGGER& m_parent;
59 std::string m_pluginName;
62 PLUGIN_LOGGER GetPluginLogger(const STG_LOGGER & logger, const std::string & pluginName);