OnixS C++ CME Market Data Handler
4.8.0.10
API documentation
Home
Contents
Namespaces
Classes
Files
File List
File Members
include
OnixS
CME
MDH
Logger.h
Go to the documentation of this file.
1
// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2
//
3
// This software owned by Onix Solutions Limited [OnixS] and is
4
// protected by copyright law and international copyright treaties.
5
//
6
// Access to and use of the software is governed by the terms of the applicable
7
// OnixS Software Services Agreement (the Agreement) and Customer end user license
8
// agreements granting a non-assignable, non-transferable and non-exclusive license
9
// to use the software for it's own data processing purposes under the terms defined
10
// in the Agreement.
11
//
12
// Except as otherwise granted within the terms of the Agreement, copying or
13
// reproduction of any part of this source code or associated reference material
14
// to any other location for further reproduction or redistribution, and any
15
// amendments to this copyright notice, are expressly prohibited.
16
//
17
// Any reproduction or redistribution for sale or hiring of the Software not in
18
// accordance with the terms of the Agreement is a violation of copyright law.
19
//
20
21
#pragma once
22
23
#include <
OnixS/CME/MDH/Integral.h
>
24
#include <
OnixS/CME/MDH/String.h
>
25
26
ONIXS_CMEMDH_NAMESPACE_BEGIN
27
28
/// Defines severity levels for log entries.
29
ONIXS_CMEMDH_LTWT_STRUCT
LogSeverity
30
{
31
/// Enumeration base.
32
typedef
UInt32
Base
;
33
34
/// Log alternates.
35
enum
Enum
36
{
37
/// Only important information like
38
/// warnings and errors will be logged.
39
///
40
/// Mode is not suitable for further log
41
/// replays, because no market data is stored.
42
Important = 10,
43
44
/// Handler will log miscellaneous aspects
45
/// related with its execution like changes
46
/// in state, network data obtained, etc. All
47
/// critical important information like warnings
48
/// and errors will be logged as well.
49
///
50
/// Most suitable mode to produce logs for further replay.
51
Regular = 50,
52
53
/// In addition to the data logged in 'Regular'
54
/// mode, Handler will output additional information
55
/// like step-by-step changes into books, step-by-step
56
/// processing of received network packets.
57
Debug = 100
58
};
59
};
60
61
/// Serializes log severity constant.
62
ONIXS_CMEMDH_EXPORTED
63
void
64
toStr
(
65
std::string&,
66
LogSeverity::Enum
);
67
68
/// Serializes log severity constant.
69
inline
70
std::string
71
toStr
(
72
LogSeverity::Enum
mode)
73
{
74
std::string str;
75
76
toStr
(str, mode);
77
78
return
str;
79
}
80
81
/// Deserializes log severity constant.
82
ONIXS_CMEMDH_EXPORTED
83
bool
84
fromStr
(
85
LogSeverity::Enum
&,
86
const
Char
*,
87
size_t
);
88
89
/// Categories for information being logged.
90
ONIXS_CMEMDH_LTWT_STRUCT
LogCategory
91
{
92
// Enumeration base.
93
typedef
UInt32
Base
;
94
95
/// Categories for information being logged.
96
enum
Enum
97
{
98
/// Log entry represents an error.
99
Error
,
100
101
/// Log entry represents a warning.
102
Warning
,
103
104
/// Log entry represents informational message.
105
Info
,
106
107
/// Log entry represents debug information.
108
Debug
109
};
110
};
111
112
/// Serializes log category constant.
113
ONIXS_CMEMDH_EXPORTED
114
void
115
toStr
(
116
std::string&,
117
LogCategory::Enum
);
118
119
/// Serializes log category constant.
120
inline
121
std::string
122
toStr
(
123
LogCategory::Enum
mode)
124
{
125
std::string str;
126
127
toStr
(str, mode);
128
129
return
str;
130
}
131
132
/// Deserializes log category constant.
133
ONIXS_CMEMDH_EXPORTED
134
bool
135
fromStr
(
136
LogCategory::Enum
&,
137
const
Char
*,
138
size_t
);
139
140
/// Abstraction of log entry in logging services.
141
ONIXS_CMEMDH_EXPORTED_CLASS
LogEntry
142
{
143
public
:
144
/// Specifies category of information being logged.
145
virtual
void
category(
LogCategory::Enum
) = 0;
146
147
/// Specifies source of information being logged.
148
virtual
void
source(
const
StrRef
&) = 0;
149
150
/// Editable text to be a message of log entry.
151
virtual
std::string& message() = 0;
152
153
/// Commits entry into a log and releases the instance.
154
///
155
/// Once given member is invoked, further invocation
156
/// of other members is not allowed as instance may be
157
/// disposed and thus do not exist anymore.
158
virtual
void
commit() = 0;
159
160
protected
:
161
/// Life-time is managed by Logger.
162
LogEntry
()
163
{
164
}
165
166
/// Life-time is managed by Logger.
167
~LogEntry
()
168
{
169
}
170
171
private
:
172
// Object copying is not supposed.
173
174
LogEntry
(
const
LogEntry
&);
175
LogEntry
& operator =(
const
LogEntry
&);
176
};
177
178
/// Abstraction of logger.
179
ONIXS_CMEMDH_EXPORTED_CLASS
Logger
180
{
181
// Object copying is not supposed.
182
183
Logger
(
const
Logger
&);
184
Logger
& operator =(
const
Logger
&);
185
186
protected
:
187
/// Only descendants are to be created.
188
Logger
()
189
{
190
}
191
192
/// Only descendants are to be created.
193
~Logger
()
194
{
195
}
196
197
public
:
198
/// Adds entry to the log.
199
///
200
/// Actual content can be added through the
201
/// interface of LogEntry and LogEvent classes.
202
///
203
/// @return Instance of LogEntry to build message
204
/// being added into the log or NULL if severity
205
/// of entry being added does not correspond to
206
/// logger's configuration.
207
virtual
208
LogEntry
*
209
addEntry(
210
LogSeverity::Enum
) = 0;
211
};
212
213
ONIXS_CMEMDH_NAMESPACE_END
OnixS::CME::MDH::LogCategory::Info
Log entry represents informational message.
Definition:
Logger.h:105
OnixS::CME::MDH::UInt32
UInt32 UInt32
uInt32.
Definition:
Fields.h:189
OnixS::CME::MDH::LogSeverity
Defines severity levels for log entries.
Definition:
Logger.h:29
OnixS::CME::MDH::LogEntry
Abstraction of log entry in logging services.
Definition:
Logger.h:141
OnixS::CME::MDH::Logger::Logger
Logger()
Only descendants are to be created.
Definition:
Logger.h:188
OnixS::CME::MDH::LogEntry::~LogEntry
~LogEntry()
Life-time is managed by Logger.
Definition:
Logger.h:167
OnixS::CME::MDH::Char
char Char
Character type alias.
Definition:
String.h:36
OnixS::CME::MDH::LogEntry::LogEntry
LogEntry()
Life-time is managed by Logger.
Definition:
Logger.h:162
ONIXS_CMEMDH_EXPORTED_CLASS
#define ONIXS_CMEMDH_EXPORTED_CLASS
Definition:
Bootstrap.h:62
ONIXS_CMEMDH_LTWT_STRUCT
#define ONIXS_CMEMDH_LTWT_STRUCT
Definition:
Bootstrap.h:114
OnixS::CME::MDH::LogCategory::Error
Log entry represents an error.
Definition:
Logger.h:99
OnixS::CME::MDH::StrRef
Provides efficient way of accessing text-based FIX field values.
Definition:
String.h:39
OnixS::CME::MDH::fromStr
ONIXS_CMEMDH_EXPORTED bool fromStr(LogCategory::Enum &, const Char *, size_t)
Deserializes log category constant.
Integral.h
ONIXS_CMEMDH_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition:
Bootstrap.h:168
OnixS::CME::MDH::toStr
std::string toStr(LogCategory::Enum mode)
Serializes log category constant.
Definition:
Logger.h:122
OnixS::CME::MDH::LogCategory
Categories for information being logged.
Definition:
Logger.h:90
OnixS::CME::MDH::Logger::~Logger
~Logger()
Only descendants are to be created.
Definition:
Logger.h:193
OnixS::CME::MDH::LogSeverity::Enum
Enum
Log alternates.
Definition:
Logger.h:35
OnixS::CME::MDH::LogSeverity::Base
UInt32 Base
Enumeration base.
Definition:
Logger.h:32
OnixS::CME::MDH::Logger
Abstraction of logger.
Definition:
Logger.h:179
OnixS::CME::MDH::LogCategory::Base
UInt32 Base
Definition:
Logger.h:93
OnixS::CME::MDH::LogCategory::Warning
Log entry represents a warning.
Definition:
Logger.h:102
String.h
OnixS::CME::MDH::LogCategory::Enum
Enum
Categories for information being logged.
Definition:
Logger.h:96
ONIXS_CMEMDH_NAMESPACE_END
#define ONIXS_CMEMDH_NAMESPACE_END
Definition:
Bootstrap.h:172