Display debug log messages in Visual Studio Output window sequoia_windows
authorThomas
Mon, 17 Jun 2019 13:23:13 +0200
branchsequoia_windows
changeset 3843cbdc7255c019
parent 3842 5be8219250cb
child 3857 825e175daca0
Display debug log messages in Visual Studio Output window
src/pEpEngine.c
src/platform_windows.cpp
src/platform_windows.h
     1.1 --- a/src/pEpEngine.c	Mon Jun 17 11:20:00 2019 +0200
     1.2 +++ b/src/pEpEngine.c	Mon Jun 17 13:23:13 2019 +0200
     1.3 @@ -2024,6 +2024,10 @@
     1.4      )
     1.5  {
     1.6  
     1.7 +#if defined(_WIN32) && !defined(NDEBUG)
     1.8 +	log_output_debug(title, entity, description, comment);
     1.9 +#endif
    1.10 +
    1.11  // N.B. If testing (so NDEBUG not defined) but this message is spam,
    1.12  //      put -D_PEP_SERVICE_LOG_OFF into CFLAGS/CXXFLAGS     
    1.13  #if !defined(NDEBUG) && !defined(_PEP_SERVICE_LOG_OFF)
     2.1 --- a/src/platform_windows.cpp	Mon Jun 17 11:20:00 2019 +0200
     2.2 +++ b/src/platform_windows.cpp	Mon Jun 17 13:23:13 2019 +0200
     2.3 @@ -372,6 +372,18 @@
     2.4      }
     2.5  }
     2.6  
     2.7 +void log_output_debug(const char *title,
     2.8 +                       const char *entity,
     2.9 +                       const char *description,
    2.10 +                       const char *comment)
    2.11 +{
    2.12 +	const size_t size = 256;
    2.13 +	char str[size];
    2.14 +	
    2.15 +	snprintf(str, size, "*** %s %s %s %s\n", title, entity, description, comment);
    2.16 +	OutputDebugStringA(str);
    2.17 +}
    2.18 +
    2.19  time_t timegm(struct tm* tm) {
    2.20      return _mkgmtime(tm);
    2.21  }
     3.1 --- a/src/platform_windows.h	Mon Jun 17 11:20:00 2019 +0200
     3.2 +++ b/src/platform_windows.h	Mon Jun 17 13:23:13 2019 +0200
     3.3 @@ -81,6 +81,8 @@
     3.4  const char *gpg_conf(void);
     3.5  const char *gpg_agent_conf(void);
     3.6  
     3.7 +void log_output_debug(const char *title, const char *entity, const char *description, const char *comment);
     3.8 +
     3.9  long random(void);
    3.10  
    3.11  // on Windoze, uuid_t needs pointer semantics