OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
LoggingSettings.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
25
28
30
51
53ONIXS_CONFLATEDUDP_EXPORTED
54void
56 std::string&,
58
60inline
61std::string
64{
65 std::string str;
66
67 toStr(str, tracing);
68
69 return str;
70}
71
73ONIXS_CONFLATEDUDP_EXPORTED
74bool
77 const Char*,
78 size_t);
79
83{
84 const SettingGroup& group_;
85
86 bool traceFeeds_;
87 MessageTracing::Enum traceMessages_;
88 bool traceBooks_;
89
90protected:
91 // To let assignment be controlled
92 // by the master container.
93 friend
95 (
97 );
98
99 // Re-initializes the given instance
100 // as a copy of the other one without
101 // involving assignment control service.
102 void
104 const
106 {
107 traceFeeds_ =
108 other.traceFeeds_;
109
110 traceMessages_ =
111 other.traceMessages_;
112
113 traceBooks_ =
114 other.traceBooks_;
115 }
116
117public:
120 const SettingGroup* group = NULL)
121 : group_(
122 group
123 ? *group
124 : SettingGroup::null())
125 , traceFeeds_(false)
126 , traceMessages_(
127 MessageTracing::Disabled)
128 , traceBooks_(false)
129 {
130 }
131
134 const DebugLoggingSettings& other)
135 : group_(
136 SettingGroup::null())
137 , traceFeeds_(
138 other.traceFeeds_)
139 , traceMessages_(
140 other.traceMessages_)
141 , traceBooks_(
142 other.traceBooks_)
143 {
144 }
145
150
153 bool
155 {
156 return traceFeeds_;
157 }
158
160 void
162 bool status)
163 {
164 group_.
165 controlAssignment
166 (
167 "Trace Feeds",
168 traceFeeds_,
169 status
170 );
171 }
172
175 MessageTracing::
176 Enum
178 {
179 return traceMessages_;
180 }
181
183 void
185 MessageTracing::Enum tracing)
186 {
187 group_.
188 controlAssignment
189 (
190 "Trace Messages",
191 traceMessages_,
192 tracing
193 );
194 }
195
198 bool
200 {
201 return traceBooks_;
202 }
203
205 void
207 bool status)
208 {
209 group_.
210 controlAssignment
211 (
212 "TraceBooks",
213 traceBooks_,
214 status
215 );
216 }
217
220 operator =(
221 const
223 {
224 group_.
225 controlAssignment
226 (
227 "Debug Logging Settings",
229 *this,
230 other
231 );
232
233 return *this;
234 }
235};
236
237#if !defined (ONIXS_CONFLATEDUDP_NO_DEPRECATED)
238
239typedef
240DebugLoggingSettings
242
243#endif // ONIXS_CONFLATEDUDP_NO_DEPRECATED
244
246ONIXS_CONFLATEDUDP_EXPORTED
247void
249 std::string&,
250 const DebugLoggingSettings&);
251
253inline
254std::string
256 const
257 DebugLoggingSettings& settings)
258{
259 std::string str;
260
261 toStr(str, settings);
262
263 return str;
264}
265
269{
271 static Logger& logger()
272 {
273 static NullLogger nullLogger;
274
275 return nullLogger;
276 }
277};
278
283 : public SettingGroup
284{
285 friend
287 (
289 );
290
291 Logger* logger_;
292
294
295 const
296 SettingGroup&
297 group() const
298 {
299 return *this;
300 }
301
302 void
303 assignNoControl(
304 const LoggingSettings& other)
305 {
306 logger_ =
307 other.logger_;
308
309 debug_.
310 assignNoControl(
311 other.debug_);
312 }
313
314public:
318 controller = NULL)
319 : SettingGroup(controller)
320 , logger_(&LoggingDefaults::logger())
321 , debug_(&group())
322 {
323 }
324
327 const LoggingSettings& other)
328 : SettingGroup()
329 , logger_(other.logger_)
330 , debug_(other.debug_)
331 {
332 }
333
340 Logger* logger() const
341 {
342 return
343 (
345 logger() != logger_
346 ? logger_
347 : NULL
348 );
349 }
350
357 {
358 return *logger_;
359 }
360
365 void
367 Logger* logger)
368 {
369 group().
371 (
372 "Logger",
373 logger_,
374 logger
375 ? logger
377 );
378 }
379
386 const
388 debug() const
389 {
390 return debug_;
391 }
392
401 {
402 return debug_;
403 }
404
408 operator =(
409 const LoggingSettings& other)
410 {
411 group().
413 (
414 "Logging Settings",
415 &LoggingSettings::assignNoControl,
416 *this,
417 other
418 );
419
420 return *this;
421 }
422};
423
425ONIXS_CONFLATEDUDP_EXPORTED
426void
428 std::string&,
429 const LoggingSettings&);
430
432inline
433std::string
435 const
436 LoggingSettings& settings)
437{
438 std::string str;
439
440 toStr(str, settings);
441
442 return str;
443}
444
#define ONIXS_CONFLATEDUDP_LTWT_STRUCT
Definition Bootstrap.h:99
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_EXPORTED_STRUCT
Definition Bootstrap.h:59
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:107
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
Parameters affecting what's logged at a debug level.
~DebugLoggingSettings()
Cleans everything up (if necessary).
void traceBooks(bool status)
Indicates whether books are traced.
DebugLoggingSettings(const SettingGroup *group=NULL)
Initializes default settings.
void traceMessages(MessageTracing::Enum tracing)
Defines the way SBE messages are traced.
DebugLoggingSettings(const DebugLoggingSettings &other)
Initializes as a copy.
void assignNoControl(const DebugLoggingSettings &other)
void traceFeeds(bool status)
Defines whether feeds are to be traced.
Abstraction of logger.
Definition Logger.h:180
LoggingSettings(SettingAssignController *controller=NULL)
Initializes the instance with the default values.
LoggingSettings(const LoggingSettings &other)
Initializes as a copy of the other instance.
const DebugLoggingSettings & debug() const
Base services for settings grouped by a certain criteria.
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
ONIXS_CONFLATEDUDP_EXPORTED bool fromStr(Decimal &, const Char *, size_t)
ONIXS_CONFLATEDUDP_EXPORTED void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
char Char
Character type alias.
Definition String.h:36
UInt32 UInt32
uInt32.
Definition Fields.h:261
DebugLoggingSettings HandlerDebugLoggingSettings
static Logger & logger()
Returns instance of the default logger.
Defines how SBE messages are traced.
Enum
Defines how SBE messages are traced.
@ FixFormat
Messages are traced in FIX tag=value format.
@ Disabled
Message tracing is disabled.
Implements logging services to put data to nowhere.
Definition NullLogger.h:29