Browse Source

use solution pattern from pEp/platform_windows.h for windows compat (Move this to engine via PR, once working)

LIB-18 Release_3.0-RC7
heck 3 months ago
parent
commit
e105634189
2 changed files with 10 additions and 5 deletions
  1. +1
    -1
      src/pEpLog.cc
  2. +9
    -4
      src/pEpLog.hh

+ 1
- 1
src/pEpLog.cc View File

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


+ 9
- 4
src/pEpLog.hh View File

@ -11,6 +11,11 @@
// Win - process.h
#ifdef WIN32
#include <process.h>
// TODO: once this works, move this to pEpEngine platform_windows.h and file a PR
#ifndef getpid
#define getpid() _getpid()
#endif
#else
#include <unistd.h>
#endif
@ -49,7 +54,7 @@
do { \
if (pEp::Adapter::pEpLog::get_enabled()) { \
std::stringstream msg_; \
msg_ << "[" << _getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << "[" << getpid() << " " << std::this_thread::get_id() << "]"; \
msg_ << " - " << __FILE__ << "::" << __FUNCTION__; \
msg_ << " - " << msg; \
pEp::Adapter::pEpLog::log(msg_.str()); \
@ -67,7 +72,7 @@
do { \
if (pEp::Adapter::pEpLog::get_enabled()) { \
std::stringstream msg_; \
msg_ << "[" << _getpid() << " " << 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()); \
@ -85,7 +90,7 @@
do { \
if (pEp::Adapter::pEpLog::get_enabled()) { \
std::stringstream msg_; \
msg_ << "[" << _getpid() << " " << 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()); \
@ -176,7 +181,7 @@ namespace pEp {
#define pEpLogClass(msg) \
do { \
std::stringstream msg_; \
msg_ << "[" << _getpid() << " " << 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__; \


Loading…
Cancel
Save