16 template <
class T,
template<
class>
class StWsCreationPolicy=
StWsCreateMeyers>
20 static T& Instance() {
22 m_pInstance=StWsCreationPolicy<T>::Create();
30 static T* m_pInstance;
33 template <
class T,
template<
class>
class C>
46 enum LEVEL {TRACE = 1, DEBUG = 2, INFO = 3, NOTICE = 4, WARNING = 5, ERROR = 6, CRITICAL = 7, ALERT = 8, FATAL = 9 };
47 enum STAGE {START = 1, STATUS = 2, END = 3};
49 void logEvent(LEVEL lvl,
const picojson::object& evt, STAGE stg = STATUS,
bool nobacklog =
false);
50 void logJobUpdate(
const picojson::object& evt,
bool nobacklog =
false);
52 void setServiceUrl(
const std::string& url);
53 void setJobID(
const std::string&
id);
54 void setTaskID(
const std::string&
id);
57 double getTimeMs()
const;
58 std::string getUserName()
const;
59 std::string getHostName()
const;
61 std::string getServiceUrl();
62 std::string getJobID();
63 std::string getTaskID();
64 int makeHttpPostCurl(
const char* url,
const std::string& json_data, std::string& response);
68 std::string mServiceUrl;
73 std::vector<std::string> mEventBackLog;
74 std::vector<std::string> mJobUpdateBackLog;
77 #define WS_JOB_LOG(evt) StWsLoggerS::Instance().logJobUpdate(evt);
79 #define WS_LOG_TRACE(evt) StWsLoggerS::Instance().logEvent(StWsLogger::TRACE, evt, StWsLogger::STATUS);
80 #define WS_LOG_DEBUG(evt) StWsLoggerS::Instance().logEvent(StWsLogger::DEBUG, evt, StWsLogger::STATUS);
81 #define WS_LOG_INFO(evt) StWsLoggerS::Instance().logEvent(StWsLogger::INFO, evt, StWsLogger::STATUS);
83 #define WS_LOG_NOTICE(evt) StWsLoggerS::Instance().logEvent(StWsLogger::NOTICE, evt, StWsLogger::STATUS);
84 #define WS_LOG_WARNING(evt) StWsLoggerS::Instance().logEvent(StWsLogger::WARNING, evt, StWsLogger::STATUS);
85 #define WS_LOG_ERROR(evt) StWsLoggerS::Instance().logEvent(StWsLogger::ERROR, evt, StWsLogger::STATUS);
87 #define WS_LOG_CRITICAL(evt) StWsLoggerS::Instance().logEvent(StWsLogger::CRITICAL, evt, StWsLogger::STATUS);
88 #define WS_LOG_ALERT(evt) StWsLoggerS::Instance().logEvent(StWsLogger::ALERT, evt, StWsLogger::STATUS);
89 #define WS_LOG_FATAL(evt) StWsLoggerS::Instance().logEvent(StWsLogger::FATAL, evt, StWsLogger::STATUS);