Browse Source

verbose logging

COM-121
Volker Birk 7 years ago
parent
commit
8cdbf309f1
3 changed files with 22 additions and 2 deletions
  1. +7
    -1
      CpEpEngine.cpp
  2. +13
    -1
      CpEpEngine.h
  3. +2
    -0
      pEpCOMServerAdapter.idl

+ 7
- 1
CpEpEngine.cpp View File

@ -3,6 +3,8 @@
#include "stdafx.h"
#include "CpEpEngine.h"
#define VERBOSE(TEXT) if (verbose_mode) verbose(TEXT)
using namespace std;
using namespace pEp::utility;
@ -25,7 +27,11 @@ STDMETHODIMP CpEpEngine::InterfaceSupportsErrorInfo(REFIID riid)
#define FAIL(msg) error(msg)
// CpEpEngine
STDMETHODIMP CpEpEngine::verbose_logging(BOOL enable)
{
verbose_mode = enable != 0;
return S_OK;
}
STDMETHODIMP CpEpEngine::log(BSTR title, BSTR entity, BSTR description, BSTR comment)
{


+ 13
- 1
CpEpEngine.h View File

@ -32,7 +32,7 @@ protected:
static int examine_identity(pEp_identity *ident, void *management);
public:
CpEpEngine() : keymanagement_thread(NULL), identity_queue(NULL)
CpEpEngine() : keymanagement_thread(NULL), identity_queue(NULL), verbose_mode(false)
{
PEP_STATUS status = ::init(&m_session);
assert(status == PEP_STATUS_OK);
@ -109,13 +109,25 @@ protected:
static ::pEp_identity * retrieve_next_identity(void *management);
HRESULT error(_bstr_t msg);
void verbose(string text)
{
if (verbose_mode) {
stringstream ss;
ss << __FILE__ << ":" << __LINE__ << " " << text;
::log_event(get_session(), "verbose", "pEp COM Server Adapter", ss.str().c_str(), NULL);
}
}
private:
PEP_SESSION m_session;
mutex session_mutex;
atomic< identity_queue_t * > identity_queue;
thread *keymanagement_thread;
bool verbose_mode;
public:
STDMETHOD(verbose_logging)(BOOL enable);
STDMETHOD(log)(BSTR title, BSTR entity, BSTR description, BSTR comment);
STDMETHOD(decrypt)(BSTR ctext, BSTR * ptext, LPSAFEARRAY * key_list, pEp_STATUS * decrypt_status);
STDMETHOD(decrypt_b)(BSTR ctext, LPSAFEARRAY * ptext, LPSAFEARRAY * key_list, pEp_STATUS * decrypt_status);


+ 2
- 0
pEpCOMServerAdapter.idl View File

@ -15,6 +15,8 @@ import "ocidl.idl";
pointer_default(unique)
]
interface IpEpEngine : IUnknown {
HRESULT verbose_logging([in] BOOL enable);
typedef enum _pEp_STATUS {
pEp_STATUS_OK = 0,


Loading…
Cancel
Save