@@ -38,8 +38,9 @@ interface
38
38
type
39
39
// / abstract parent containing information able to initialize a TSynDaemon class
40
40
// - will handle persistence as JSON local files
41
- // - you may consider using TDDDAppSettingsAbstract from dddInfraSettings
42
- TSynDaemonSettings = class (TSynJsonFileSettings)
41
+ // - by default in this abstract parent class, no property is published to let
42
+ // inherited classes define the values customizable from JSON serialization
43
+ TSynDaemonAbstractSettings = class (TSynJsonFileSettings)
43
44
protected
44
45
fServiceName: string;
45
46
fServiceDisplayName: string;
@@ -68,7 +69,6 @@ TSynDaemonSettings = class(TSynJsonFileSettings)
68
69
// - several depending services may be set by appending #0 between names
69
70
property ServiceDependencies: string
70
71
read fServiceDependencies write fServiceDependencies;
71
- published
72
72
// / the service name, as used internally by Windows or the TSynDaemon class
73
73
// - default is the executable name
74
74
property ServiceName: string
@@ -87,9 +87,30 @@ TSynDaemonSettings = class(TSynJsonFileSettings)
87
87
property LogRotateFileCount: integer
88
88
read fLogRotateFileCount write fLogRotateFileCount;
89
89
end ;
90
+
91
+ // / abstract parent containing information able to initialize a TSynDaemon class
92
+ // - by default, will publish the principal properties to that RTTI will handle
93
+ // persistence as JSON local files
94
+ TSynDaemonSettings = class (TSynDaemonAbstractSettings)
95
+ published
96
+ // / the service name, as used internally by Windows or the TSynDaemon class
97
+ // - default is the executable name
98
+ property ServiceName;
99
+ // / the service name, as displayed by Windows or at the console level
100
+ // - default is the executable name
101
+ property ServiceDisplayName;
102
+ // / if not void, will enable the logs (default is LOG_STACKTRACE)
103
+ property Log: TSynLogInfos
104
+ read fLog write fLog;
105
+ // / allow to customize where the logs should be written
106
+ property LogPath: TFileName
107
+ read fLogPath write fLogPath;
108
+ // / how many files will be rotated (default is 2)
109
+ property LogRotateFileCount;
110
+ end ;
90
111
91
112
// / meta-class of TSynDaemon settings information
92
- TSynDaemonSettingsClass = class of TSynDaemonSettings ;
113
+ TSynDaemonSettingsClass = class of TSynDaemonAbstractSettings ;
93
114
94
115
95
116
@@ -106,7 +127,7 @@ TSynDaemon = class(TSynPersistent)
106
127
protected
107
128
fConsoleMode: boolean;
108
129
fWorkFolderName: TFileName;
109
- fSettings: TSynDaemonSettings ;
130
+ fSettings: TSynDaemonAbstractSettings ;
110
131
function CustomCommandLineSyntax : string; virtual ;
111
132
{ $ifdef OSWINDOWS}
112
133
procedure DoStart (Sender: TService);
@@ -137,7 +158,7 @@ TSynDaemon = class(TSynPersistent)
137
158
read fConsoleMode;
138
159
// / the settings associated with this daemon
139
160
// - will be allocated in Create constructor, and released in Destroy
140
- property Settings: TSynDaemonSettings
161
+ property Settings: TSynDaemonAbstractSettings
141
162
read fSettings;
142
163
end ;
143
164
@@ -148,9 +169,9 @@ implementation
148
169
149
170
{ ************ Parent Daemon Settings Class }
150
171
151
- { TSynDaemonSettings }
172
+ { TSynDaemonAbstractSettings }
152
173
153
- constructor TSynDaemonSettings .Create;
174
+ constructor TSynDaemonAbstractSettings .Create;
154
175
begin
155
176
inherited Create;
156
177
fLog := LOG_STACKTRACE + [sllNewRun];
@@ -159,7 +180,7 @@ constructor TSynDaemonSettings.Create;
159
180
fServiceDisplayName := fServiceName;
160
181
end ;
161
182
162
- function TSynDaemonSettings .ServiceDescription : string;
183
+ function TSynDaemonAbstractSettings .ServiceDescription : string;
163
184
var
164
185
versionnumber: string;
165
186
begin
@@ -174,7 +195,7 @@ function TSynDaemonSettings.ServiceDescription: string;
174
195
end ;
175
196
end ;
176
197
177
- procedure TSynDaemonSettings .SetLog (aLogClass: TSynLogClass);
198
+ procedure TSynDaemonAbstractSettings .SetLog (aLogClass: TSynLogClass);
178
199
begin
179
200
if (self <> nil ) and
180
201
(Log <> []) and
0 commit comments