Browse Source

pEpLog - Add PID

LIB-11
heck 1 year ago
parent
commit
e5aa2284ae
3 changed files with 12 additions and 9 deletions
  1. +1
    -1
      src/pEpLog.cc
  2. +7
    -5
      src/pEpLog.hh
  3. +4
    -3
      test/framework/utils.hh

+ 1
- 1
src/pEpLog.cc View File

@ -98,7 +98,7 @@ namespace pEp {
void pEpLogger::log(const string& msg) const
{
std::stringstream msg_;
msg_ << std::this_thread::get_id();
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]";
msg_ << " - ";
msg_ << this->get_classname() << "[" << this->get_instancename() << "]";
msg_ << " - " << msg;


+ 7
- 5
src/pEpLog.hh View File

@ -6,6 +6,8 @@
#include <sstream>
#include <thread>
#include <unistd.h>
// pEpLog
// ======
// a "to be kept ultra small and simple" logging unit.
@ -36,7 +38,7 @@
do { \
if (pEp::Adapter::pEpLog::get_enabled()) { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << msg; \
pEp::Adapter::pEpLog::log(msg_.str()); \
@ -54,7 +56,7 @@
do { \
if (pEp::Adapter::pEpLog::get_enabled()) { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << pEp::Adapter::pEpLog::decorateH1(msg); \
pEp::Adapter::pEpLog::log(msg_.str()); \
@ -72,7 +74,7 @@
do { \
if (pEp::Adapter::pEpLog::get_enabled()) { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << pEp::Adapter::pEpLog::decorateH2(msg); \
pEp::Adapter::pEpLog::log(msg_.str()); \
@ -162,7 +164,7 @@ namespace pEp {
#define pEpLogClass(msg) \
do { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << this->m4gic_logger_n4me.get_classname(); \
msg_ << "[" << this->m4gic_logger_n4me.get_instancename() << "]"; \
msg_ << "::" << __FUNCTION__; \
@ -182,7 +184,7 @@ namespace pEp {
#else
#define pEpLogClassRaw(msg) \
do { \
this->m4gic_logger_n4me.logRaw(msg); \
this->m4gic_logger_n4me.logRaw(msg); \
} while (0)
#endif // NDEBUG


+ 4
- 3
test/framework/utils.hh View File

@ -9,6 +9,7 @@
#include <exception>
#include <chrono>
#include <thread>
#include <unistd.h>
// ------------------------------------------------------------------------------------------------
@ -36,7 +37,7 @@
#define TESTLOG(msg) \
do { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << msg; \
pEp::Adapter::pEpLog::log(msg_.str()); \
@ -48,7 +49,7 @@
#define TESTLOGH1(msg) \
do { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << pEp::Adapter::pEpLog::decorateH1(msg); \
pEp::Adapter::pEpLog::log(msg_.str()); \
@ -60,7 +61,7 @@
#define TESTLOGH2(msg) \
do { \
std::stringstream msg_; \
msg_ << std::this_thread::get_id(); \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << pEp::Adapter::pEpLog::decorateH2(msg); \
pEp::Adapter::pEpLog::log(msg_.str()); \


Loading…
Cancel
Save