-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathDebugLoggerSink.cpp
52 lines (41 loc) · 1.24 KB
/
DebugLoggerSink.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "stdafx.h"
#include "DebugLoggerSink.h"
using namespace MicrosoftInstrumentationEngine;
HRESULT CDebugLoggerSink::Initialize(_In_ CLoggerService* pLogging)
{
m_pLogging = pLogging;
return S_OK;
}
void CDebugLoggerSink::LogMessage(_In_ LPCWSTR wszMessage)
{
OutputDebugString(wszMessage);
OutputDebugString(_T("\r\n"));
}
void CDebugLoggerSink::LogError(_In_ LPCWSTR wszMessage)
{
OutputDebugString(wszMessage);
OutputDebugString(_T("\r\n"));
}
void CDebugLoggerSink::LogDumpMessage(_In_ LPCWSTR wszMessage)
{
OutputDebugString(wszMessage);
OutputDebugString(_T("\r\n"));
}
HRESULT CDebugLoggerSink::Reset(_In_ LoggingFlags defaultFlags, _Out_ LoggingFlags* pEffectiveFlags)
{
if (!pEffectiveFlags)
{
return E_POINTER;
}
*pEffectiveFlags = LoggingFlags_None;
CComPtr<IProfilerManagerLoggingHost> pLoggingHost;
m_pLogging->GetLoggingHost(&pLoggingHost);
// Enable all logging via debug port if there is no logging host or it was explicitly asked to log.
if (!pLoggingHost || m_pLogging->GetLogToDebugPort())
{
*pEffectiveFlags = defaultFlags;
}
return S_OK;
}