GELF remote logging to graylog

This commit is contained in:
2022-12-11 11:50:01 +08:00
parent 31bd0c87ae
commit 04819714be
6 changed files with 153 additions and 79 deletions
+5 -5
View File
@@ -17,14 +17,14 @@
#include <sys/types.h>
#include <unistd.h>
inline std::string NowTime();
inline gelfcpp::decorator::CurrentTimestamp CurrentTimeStamp();
void GraylogStream(std::string raw);
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logSQL, FLOG_MAX};
extern TLogLevel global_log_level;
inline gelfcpp::decorator::CurrentTimestamp CurrentTimeStamp();
inline std::string NowTime();
void GraylogStream(TLogLevel level, std::string raw);
void logfmt( TLogLevel level, const char * format, ... );
template <typename T>
@@ -71,7 +71,7 @@ Log<T>::~Log()
}
// Graylog
GraylogStream(os.str());
GraylogStream(currentLevel, os.str());
os << std::endl;