OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
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
26#include <cstddef>
27#include <string>
28
30
33{
36
38 enum Enum
39 {
45
49 Regular = 50,
50
55 Debug = 100
56 };
57};
58
65void toStr(std::string& str, LogSeverity::Enum severity);
66
73{
74 std::string str;
75
76 toStr(str, severity);
77
78 return str;
79}
80
89bool fromStr(LogSeverity::Enum& severity, const Messaging::Char* str, size_t size);
90
93{
96
98 enum Enum
99 {
102
105
108
111 };
112};
113
120void toStr(std::string& str, LogCategory::Enum category);
121
128{
129 std::string str;
130
131 toStr(str, category);
132
133 return str;
134}
135
151bool fromStr(LogCategory::Enum& category, const Messaging::Char* str, size_t size);
152
158{
159public:
163 virtual void category(LogCategory::Enum value) = 0;
164
168 virtual void source(const Messaging::StrRef& value) = 0;
169
174 virtual std::string& message() = 0;
175
182 virtual void commit() = 0;
183
184protected:
186 LogEntry() = default;
187
189 virtual ~LogEntry() = default;
190
191private:
192 LogEntry(const LogEntry&) = delete;
193 LogEntry& operator=(const LogEntry&) = delete;
194};
195
198{
199public:
201 virtual ~Logger() noexcept = default;
202
207 virtual void info(std::string& str) = 0;
208
219 virtual LogEntry* addEntry(LogSeverity::Enum severity) = 0;
220
221protected:
223 Logger() = default;
224
225private:
226 Logger(const Logger&) = delete;
227 Logger& operator=(const Logger&) = delete;
228};
229
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:69
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:61
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:73
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:163
#define ONIXS_CMEMDH_NODISCARD
Definition Compiler.h:165
Provides a mutable log entry whose lifetime is controlled by its logger.
Definition Logger.h:158
LogEntry()=default
Initializes an entry for use by a concrete logger implementation.
virtual ~LogEntry()=default
Finalizes an entry whose lifetime is managed by its logger.
virtual std::string & message()=0
Provides mutable access to the entry message.
virtual void source(const Messaging::StrRef &value)=0
Sets the component or subsystem that produced the entry.
virtual void commit()=0
Submits the entry to the logger and releases it.
virtual void category(LogCategory::Enum value)=0
Sets the category of the entry.
virtual void info(std::string &str)=0
Appends a description of the logger implementation to a string.
virtual LogEntry * addEntry(LogSeverity::Enum severity)=0
Acquires a mutable entry for submission to the log.
virtual ~Logger() noexcept=default
Finalizes the logger.
Logger()=default
Initializes the base of a concrete logger implementation.
std::uint32_t UInt32
uInt32.
Definition Integral.h:35
char Char
Character type alias.
Definition String.h:30
std::basic_string_view< Char > StrRef
Definition StrRef.h:46
void fromStr(NifList &, const std::string &, const std::string &=std::string("; ,"))
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
STL namespace.
Classifies the purpose of an individual log entry.
Definition Logger.h:93
Messaging::UInt32 Base
Integral type used to store and serialize values of Enum.
Definition Logger.h:95
Enum
Available log entry categories.
Definition Logger.h:99
@ Info
Reports informational activity.
Definition Logger.h:107
@ Warning
Reports a warning.
Definition Logger.h:104
@ Error
Reports an error.
Definition Logger.h:101
@ Debug
Reports diagnostic details intended for debugging.
Definition Logger.h:110
Defines the amount of diagnostic and market data written to a log.
Definition Logger.h:33
Messaging::UInt32 Base
Integral type used to store and serialize values of Enum.
Definition Logger.h:35
Enum
Available logging detail levels.
Definition Logger.h:39
@ Regular
Records normal handler activity, market data, warnings, and errors.
Definition Logger.h:49
@ Important
Records warnings, errors, and other important information only.
Definition Logger.h:44
@ Debug
Records detailed processing diagnostics in addition to regular data.
Definition Logger.h:55