forked from CobaltFusion/DebugViewPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogSource.cpp
More file actions
96 lines (77 loc) · 2.21 KB
/
Copy pathLogSource.cpp
File metadata and controls
96 lines (77 loc) · 2.21 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "CobaltFusion/Str.h"
#include "DebugViewppLib/LogSource.h"
#include "DebugViewppLib/LineBuffer.h"
#include "DebugViewppLib/ProcessInfo.h"
namespace fusion {
namespace debugviewpp {
LogSource::LogSource(Timer& timer, SourceType::type sourceType, ILineBuffer& linebuffer) :
m_linebuffer(linebuffer),
m_sourceType(sourceType),
m_timer(timer)
{
}
LogSource::~LogSource() = default;
void LogSource::SetAutoNewLine(bool value)
{
m_autoNewLine = value;
}
bool LogSource::GetAutoNewLine() const
{
return m_autoNewLine;
}
void LogSource::Initialize()
{
}
void LogSource::Abort()
{
m_end = true;
}
bool LogSource::AtEnd() const
{
return m_end;
}
void LogSource::PreProcess(Line& line) const
{
if (line.handle != nullptr)
{
line.processName = Str(ProcessInfo::GetProcessName(line.handle)).str();
}
}
std::wstring LogSource::GetDescription() const
{
return m_description;
}
void LogSource::SetDescription(const std::wstring& description)
{
m_description = description;
}
SourceType::type LogSource::GetSourceType() const
{
return m_sourceType;
}
void LogSource::Add(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message)
{
m_linebuffer.Add(time, systemTime, pid, processName, message, this);
}
void LogSource::Add(DWORD pid, const std::string& processName, const std::string& message)
{
m_linebuffer.Add(m_timer.Get(), Win32::GetSystemTimeAsFileTime(), pid, processName, message, this);
}
void LogSource::Add(HANDLE handle, const std::string& message) const
{
m_linebuffer.Add(m_timer.Get(), Win32::GetSystemTimeAsFileTime(), handle, message, this);
}
void LogSource::Add(const std::string& message)
{
m_linebuffer.Add(m_timer.Get(), Win32::GetSystemTimeAsFileTime(), 0, "", message, this);
}
void LogSource::AddInternal(const std::string& message) const
{
m_linebuffer.Add(m_timer.Get(), Win32::GetSystemTimeAsFileTime(), 0, "[internal]", message, this);
}
} // namespace debugviewpp
} // namespace fusion