OnixS C++ CME MDP Premium Market Data Handler 5.9.0
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
30
33{
34public:
37 : filename_()
38 , fileSizeLimit_(2145386496)
39 , severity_(LogSeverity::Regular)
40 , watch_(&UtcWatch::service())
41 {
42 }
43
46
50 const std::string& filename() const
51 {
52 return filename_;
53 }
54
58 void filename(const std::string& value)
59 {
60 filename_ = value;
61 }
62
70 {
71 return fileSizeLimit_;
72 }
73
76 {
77 fileSizeLimit_ = value;
78 }
79
85 {
86 return severity_;
87 }
88
92 {
93 severity_ = value;
94 }
95
99 {
100 return *watch_;
101 }
102
106 {
107 watch_ = &watch;
108 }
109
110private:
111 std::string filename_;
112 UInt64 fileSizeLimit_;
113
114 LogSeverity::Enum severity_;
115
116 WatchService* watch_;
117};
118
122
124
127{
133 virtual void onFileLoggerIssue(const FileLogger&, const Char*) {}
134};
135
140{
141public:
144
147
150
153 void info(std::string&) ONIXS_CMEMDH_OVERRIDE;
154
161
170 std::string rollover();
171
172private:
173 // File logger machinery implementation.
175
176 Workhorse* workhorse_;
177};
178
#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_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:35
#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
#define ONIXS_CMEMDH_OVERRIDE
Definition Compiler.h:176
Base parameters affecting synchronous logging services.
Definition FileLogger.h:33
void severityLevel(LogSeverity::Enum value)
Specifies whether logger should output its events and which of events should be put into the log.
Definition FileLogger.h:91
const std::string & filename() const
Log file name.
Definition FileLogger.h:50
LogSeverity::Enum severityLevel() const
Specifies whether the logger should output events and which of events should be put into the log.
Definition FileLogger.h:84
void filename(const std::string &value)
Updates log file name.
Definition FileLogger.h:58
UInt64 fileSizeLimit() const
Log file size limit (in bytes).
Definition FileLogger.h:69
FileLoggerSettings()
Initializes parameters with default values.
Definition FileLogger.h:36
void watch(WatchService &watch)
Watch service used by logger while assigning timestamps to log entries.
Definition FileLogger.h:105
~FileLoggerSettings()
Cleans everything up.
Definition FileLogger.h:45
WatchService & watch() const
Watch service used by logger while assigning timestamps to log entries.
Definition FileLogger.h:98
void fileSizeLimit(UInt64 value)
Sets logFileSizeLimit.
Definition FileLogger.h:75
Implements logging services to put logged data into a regular file.
Definition FileLogger.h:140
void info(std::string &) override
Basic information on the implementation of the logging services.
~FileLogger() override
Disposes logging machinery.
std::string rollover()
Rolls over current log and starts recording a new chunk.
LogEntry * addEntry(LogSeverity::Enum) override
Adds a new entry into the log.
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()
Only descendants are to be created.
Definition Logger.h:178
std::string makeLogFilename(UInt32)
Makes filename for log file for the given channel.
UInt64 UInt64
uInt64.
Definition Fields.h:205
char Char
Character type alias.
Definition String.h:36
UInt32 UInt32
uInt32.
Definition Fields.h:202
Collection of events raised by FileLogger during its life time.
Definition FileLogger.h:127
virtual void onFileLoggerIssue(const FileLogger &, const Char *)
Invoked by FileLogger in case of issue.
Definition FileLogger.h:133
Defines severity levels for log entries.
Definition Logger.h:30
Enum
Log alternates.
Definition Logger.h:36
Abstract watch service.
Definition Watch.h:30