OnixS C++ CME MDP Premium Market Data Handler 5.10.2
Users' manual and API documentation
Loading...
Searching...
No Matches
FileLogger.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#include <OnixS/CME/MDH/Watch.h>
28
29#include <OnixS/CME/MDH/Auxiliary/DeprecatedHeaderWarnings.Disable.h>
31#include <OnixS/CME/MDH/Auxiliary/DeprecatedHeaderWarnings.Restore.h>
32
34
37{
38public:
41 : filename_()
42 , fileSizeLimit_(2145386496)
43 , severity_(LogSeverity::Regular)
44 , watch_(&UtcWatch::service())
45 {
46 }
47
50
54 const std::string& filename() const
55 {
56 return filename_;
57 }
58
62 void filename(const std::string& value)
63 {
64 filename_ = value;
65 }
66
74 {
75 return fileSizeLimit_;
76 }
77
80 {
81 fileSizeLimit_ = value;
82 }
83
89 {
90 return severity_;
91 }
92
96 {
97 severity_ = value;
98 }
99
103 {
104 return *watch_;
105 }
106
110 {
111 watch_ = &watch;
112 }
113
114private:
115 std::string filename_;
116 Messaging::UInt64 fileSizeLimit_;
117
118 LogSeverity::Enum severity_;
119
120 WatchService* watch_;
121};
122
126
128
139
144{
145public:
148
150 ~FileLogger() override;
151
154
157 void info(std::string&) override;
158
165
174 std::string rollover();
175
176private:
177 // File logger machinery implementation.
179
180 Workhorse* workhorse_;
181};
182
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:54
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:48
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:35
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:55
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:148
Base parameters affecting synchronous logging services.
Definition FileLogger.h:37
void fileSizeLimit(Messaging::UInt64 value)
Sets logFileSizeLimit.
Definition FileLogger.h:79
void severityLevel(LogSeverity::Enum value)
Definition FileLogger.h:95
const std::string & filename() const
Definition FileLogger.h:54
~FileLoggerSettings()=default
Cleans everything up.
Messaging::UInt64 fileSizeLimit() const
Definition FileLogger.h:73
LogSeverity::Enum severityLevel() const
Definition FileLogger.h:88
void filename(const std::string &value)
Definition FileLogger.h:62
FileLoggerSettings()
Initializes parameters with default values.
Definition FileLogger.h:40
void watch(WatchService &watch)
Definition FileLogger.h:109
WatchService & watch() const
Definition FileLogger.h:102
void info(std::string &) override
~FileLogger() override
Disposes logging machinery.
LogEntry * addEntry(LogSeverity::Enum) override
FileLogger(const FileLoggerSettings &, FileLoggerListener *=nullptr)
Initializes logger according to given settings.
const FileLoggerSettings & settings() const
Configuration of given logger instance.
Abstraction of log entry in logging services.
Definition Logger.h:122
Logger()=default
Only descendants are to be created.
std::uint32_t UInt32
uInt32.
Definition Integral.h:35
char Char
Character type alias.
Definition String.h:30
std::uint64_t UInt64
uInt64.
Definition Integral.h:37
std::string makeLogFilename(Messaging::UInt32)
Makes filename for log file for the given channel.
Collection of events raised by FileLogger during its life time.
Definition FileLogger.h:131
virtual void onFileLoggerIssue(const FileLogger &, const Messaging::Char *)
Definition FileLogger.h:137
Defines severity levels for log entries.
Definition Logger.h:30
Enum
Log alternates.
Definition Logger.h:36
Abstract watch service.
Definition Watch.h:35