OnixS C++ CME MDP Premium Market Data Handler 5.9.0
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
27
29
32{
34 typedef UInt32 Base;
35
37 enum Enum
38 {
41
45
48 };
49};
50
53void toStr(std::string&, MessageTracing::Enum);
54
56inline std::string toStr(MessageTracing::Enum tracing)
57{
58 std::string str;
59
60 toStr(str, tracing);
61
62 return str;
63}
64
67bool fromStr(MessageTracing::Enum&, const Char*, size_t);
68
71{
72public:
75 : group_(group ? *group : SettingGroup::null())
76 , traceFeeds_(false)
77 , traceMessages_(MessageTracing::Disabled)
78 , traceBooks_(false)
79 {
80 }
81
84 : group_(SettingGroup::null())
85 , traceFeeds_(other.traceFeeds_)
86 , traceMessages_(other.traceMessages_)
87 , traceBooks_(other.traceBooks_)
88 {
89 }
90
93
96 bool traceFeeds() const
97 {
98 return traceFeeds_;
99 }
100
103 {
104 group_.controlAssignment("Trace Feeds", traceFeeds_, status);
105
106 return *this;
107 }
108
112 {
113 return traceMessages_;
114 }
115
118 {
119 group_.controlAssignment("Trace Messages", traceMessages_, tracing);
120
121 return *this;
122 }
123
126 bool traceBooks() const
127 {
128 return traceBooks_;
129 }
130
133 {
134 group_.controlAssignment("TraceBooks", traceBooks_, status);
135
136 return *this;
137 }
138
141 {
142 group_.controlChange("Debug Logging Settings", &DebugLoggingSettings::assignNoControl, *this, other);
143
144 return *this;
145 }
146
147protected:
148 // To let assignment be controlled
149 // by the master container.
151
152 // Re-initializes the given instance
153 // as a copy of the other one without
154 // involving assignment control service.
156 {
157 traceFeeds_ = other.traceFeeds_;
158
159 traceMessages_ = other.traceMessages_;
160
161 traceBooks_ = other.traceBooks_;
162 }
163
164private:
165 const SettingGroup& group_;
166
167 bool traceFeeds_;
168 MessageTracing::Enum traceMessages_;
169 bool traceBooks_;
170};
171
172#if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
173
175
176#endif // ONIXS_CMEMDH_NO_DEPRECATED
177
180void toStr(std::string&, const DebugLoggingSettings&);
181
183inline std::string toStr(const DebugLoggingSettings& settings)
184{
185 std::string str;
186
187 toStr(str, settings);
188
189 return str;
190}
191
195{
197 static Logger& logger();
198
199 static const char* fileName()
200 {
201 return "OnixS.CmeMdpPremiumCppHandlers.log";
202 }
203
204private:
205 static FileLoggerSettings createSettings()
206 {
207 FileLoggerSettings fileLoggerSettings;
208 fileLoggerSettings.filename(fileName());
209
210 return fileLoggerSettings;
211 }
212};
213
217{
218public:
221 : SettingGroup(controller)
222 , logger_(&LoggingDefaults::logger())
223 , debug_(&group())
224 {
225 }
226
229 : SettingGroup()
230 , logger_(other.logger_)
231 , debug_(other.debug_)
232 {
233 }
234
241 Logger* logger() const
242 {
243 return (&LoggingDefaults::logger() != logger_ ? logger_ : ONIXS_CMEMDH_NULLPTR);
244 }
245
252 {
253 return *logger_;
254 }
255
261 {
262 group().controlAssignment("Logger", logger_, logger ? logger : &LoggingDefaults::logger());
263
264 return *this;
265 }
266
274 {
275 return debug_;
276 }
277
285 {
286 return debug_;
287 }
288
292 {
293 group().controlChange("Logging Settings", &LoggingSettings::assignNoControl, *this, other);
294
295 return *this;
296 }
297
298private:
300
301 Logger* logger_;
302
304
305 const SettingGroup& group() const
306 {
307 return *this;
308 }
309
310 void assignNoControl(const LoggingSettings& other)
311 {
312 logger_ = other.logger_;
313
314 debug_.assignNoControl(other.debug_);
315 }
316};
317
320void toStr(std::string&, const LoggingSettings&);
321
323inline std::string toStr(const LoggingSettings& settings)
324{
325 std::string str;
326
327 toStr(str, settings);
328
329 return str;
330}
331
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:48
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_NULLPTR
Definition Compiler.h:178
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
Parameters affecting what's logged at a debug level.
MessageTracing::Enum traceMessages() const
Defines the way SBE messages are traced.
~DebugLoggingSettings()
Cleans everything up (if necessary).
bool traceFeeds() const
Defines whether feeds are to be traced.
DebugLoggingSettings(const SettingGroup *group=nullptr)
Initializes default settings.
DebugLoggingSettings & traceMessages(MessageTracing::Enum tracing)
Defines the way SBE messages are traced.
DebugLoggingSettings(const DebugLoggingSettings &other)
Initializes as a copy.
bool traceBooks() const
Indicates whether books are traced.
void assignNoControl(const DebugLoggingSettings &other)
DebugLoggingSettings & operator=(const DebugLoggingSettings &other)
Re-initializes as a copy.
DebugLoggingSettings & traceFeeds(bool status)
Defines whether feeds are to be traced.
DebugLoggingSettings & traceBooks(bool status)
Indicates whether books are traced.
Base parameters affecting synchronous logging services.
Definition FileLogger.h:33
const std::string & filename() const
Log file name.
Definition FileLogger.h:50
Abstraction of logger.
Definition Logger.h:156
The collection of settings affecting use of logging subsystem by the Handler.
LoggingSettings & logger(Logger *logger)
Assigns the given logger to the Handler.
DebugLoggingSettings & debug()
The collection of settings affecting debug-level logging.
LoggingSettings(const LoggingSettings &other)
Initializes as a copy of the other instance.
Logger * logger() const
The Logger instance to be used by the Handler while logging various events.
Logger & loggerOrDefault() const
The Logger instance to be used by the Handler while logging various events.
const DebugLoggingSettings & debug() const
The collection of settings affecting debug-level logging.
LoggingSettings(SettingChangeController *controller=nullptr)
Initializes the instance with the default values.
LoggingSettings & operator=(const LoggingSettings &other)
Re-initializes the instance as a copy of the other one.
Base services for settings grouped by a certain criteria.
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
Guarded assignment of the given value to the given variable.
SettingGroup(SettingChangeController *controller=nullptr)
Initializes the group of settings with the given validation services.
void controlChange(const Char *description, void(Changeable::*change)(), Changeable &changeable) const
Guarded invoke of the given routine which assumes complex change or update for the given object.
bool fromStr(Decimal &, const Char *, size_t)
Deserializes a decimal number from the given text presentation.
char Char
Character type alias.
Definition String.h:36
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
UInt32 UInt32
uInt32.
Definition Fields.h:202
DebugLoggingSettings HandlerDebugLoggingSettings
Provides default functionality for the logging-related services.
static Logger & logger()
Returns an 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.
@ SbeFormat
Messages are traced using SBE naming from coding templates for fields and their values.
@ Disabled
Message tracing is disabled.
Represents a service controlling change/update operations for the collections of settings.