OnixS C++ CME MDP Streamlined Market Data Handler  1.2.0
API Documentation
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 
25 
27 
28 /// Defines severity levels for log entries.
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.
63 void
64 toStr(
65  std::string&,
67 
68 /// Serializes log severity constant.
69 inline
70 std::string
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.
83 bool
84 fromStr(
86  const Char*,
87  size_t);
88 
89 /// Categories for information being logged.
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.
100 
101  /// Log entry represents a warning.
103 
104  /// Log entry represents informational message.
106 
107  /// Log entry represents debug information.
108  Debug
109  };
110 };
111 
112 /// Serializes log category constant.
114 void
115 toStr(
116  std::string&,
118 
119 /// Serializes log category constant.
120 inline
121 std::string
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.
134 bool
135 fromStr(
137  const Char*,
138  size_t);
139 
140 /// Abstraction of log entry in logging services.
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.
163  {
164  }
165 
166  /// Life-time is managed by Logger.
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.
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.
189  {
190  }
191 
192  /// Only descendants are to be created.
193  virtual ~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 
virtual ~Logger()
Only descendants are to be created.
Definition: Logger.h:193
Enum
Categories for information being logged.
Definition: Logger.h:96
UInt32 Base
Enumeration base.
Definition: Logger.h:32
Categories for information being logged.
Definition: Logger.h:90
bool fromStr(LogCategory::Enum &, const Char *, size_t)
Deserializes log category constant.
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition: Bootstrap.h:173
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED
Definition: Compiler.h:160
char Char
Character type alias.
Definition: String.h:36
Abstraction of log entry in logging services.
Definition: Logger.h:141
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_CLASS
Definition: Bootstrap.h:63
Log entry represents a warning.
Definition: Logger.h:102
~LogEntry()
Life-time is managed by Logger.
Definition: Logger.h:167
Provides efficient way of accessing text-based FIX field values.
Definition: String.h:39
LogEntry()
Life-time is managed by Logger.
Definition: Logger.h:162
Defines severity levels for log entries.
Definition: Logger.h:29
Log entry represents informational message.
Definition: Logger.h:105
Log entry represents an error.
Definition: Logger.h:99
Abstraction of logger.
Definition: Logger.h:179
#define ONIXS_CMESTREAMLINEDMDH_LTWT_STRUCT
Definition: Bootstrap.h:115
std::string toStr(LogCategory::Enum mode)
Serializes log category constant.
Definition: Logger.h:122
Logger()
Only descendants are to be created.
Definition: Logger.h:188
UInt32 UInt32
uInt32.
Definition: Fields.h:183
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:169