-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathILogConfiguration.hpp
464 lines (373 loc) · 15 KB
/
ILogConfiguration.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
#ifndef MAT_ILOGCONFIGURATION_HPP
#define MAT_ILOGCONFIGURATION_HPP
#include "ctmacros.hpp"
#include "Enums.hpp"
#include "stdint.h"
#include <memory>
#include <string>
#include "IModule.hpp"
#include "Variant.hpp"
namespace MAT_NS_BEGIN
{
class IModule;
class IHttpClient;
/// Default collector url to send events to
static constexpr const char* COLLECTOR_URL_PROD = "https://mobile.events.data.microsoft.com/OneCollector/1.0/";
/// <summary>
/// The URI of the United States collector.
/// </summary>
static constexpr const char* COLLECTOR_URL_UNITED_STATES = "https://us-mobile.events.data.microsoft.com/OneCollector/1.0/";
/// <summary>
/// The URI of the German collector.
/// </summary>
static constexpr const char* COLLECTOR_URL_GERMANY = "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/";
/// <summary>
/// The URI of the Australian collector.
/// </summary>
static constexpr const char* COLLECTOR_URL_AUSTRALIA = "https://au-mobile.events.data.microsoft.com/OneCollector/1.0/";
/// <summary>
/// The URI of the Japanese collector.
/// </summary>
static constexpr const char* COLLECTOR_URL_JAPAN = "https://jp-mobile.events.data.microsoft.com/OneCollector/1.0/";
/// <summary>
/// The URI of the European collector.
/// </summary>
static constexpr const char* COLLECTOR_URL_EUROPE = "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/";
/// <summary>
/// The real-time transmit profile.
/// </summary>
static constexpr const char* const TRANSMITPROFILE_REALTIME = "REAL_TIME";
/// <summary>
/// The near real-time transmit profile.
/// </summary>
static constexpr const char* const TRANSMITPROFILE_NEARREALTIME = "NEAR_REAL_TIME";
/// <summary>
/// The best effort transmit profile.
/// </summary>
static constexpr const char* const TRANSMITPROFILE_BESTEFFORT = "BEST_EFFORT";
/// <summary>
/// Enable analytics.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_ANALYTICS = "enableLifecycleSession";
/// <summary>
/// Enable multitenant.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_MULTITENANT = "multiTenantEnabled";
/// <summary>
/// Enable CRC-32 check.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_CRC32 = "enableCRC32";
/// <summary>
/// Enable HMAC authentication.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_HMAC = "enableHMAC";
/// <summary>
/// Enable dropping events if DB file size exceeds its limit.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_DB_DROP_IF_FULL = "enableDbDropIfFull";
/// <summary>
/// Enable database compression.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_DB_COMPRESS = "enableDBCompression";
/// <summary>
/// Enable WAL journal.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_WAL_JOURNAL = "enableWALJournal";
/// <summary>
/// Enable network detector.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_NET_DETECT = "enableNetworkDetector";
/// <summary>
/// Parameter that allows to check if the SDK is running on UTC mode
/// </summary>
static constexpr const char* const CFG_BOOL_UTC_ENABLED = "enabled";
/// <summary>
/// Parameter that allows to check if the SDK is running on UTC mode
/// </summary>
static constexpr const char* const CFG_BOOL_UTC_ACTIVE = "active";
/// <summary>
/// Parameter that allows to check if the Windows 10 version SDK is using supports large payloads on UTC
/// </summary>
static constexpr const char* const CFG_BOOL_UTC_LARGE_PAYLOADS = "largePayloadsEnabled";
/// <summary>
/// The event collection URI.
/// </summary>
static constexpr const char* const CFG_STR_COLLECTOR_URL = "eventCollectorUri";
/// <summary>
/// The cache file-path.
/// </summary>
static constexpr const char* const CFG_STR_CACHE_FILE_PATH = "cacheFilePath";
/// <summary>
/// the cache file size limit in bytes.
/// </summary>
static constexpr const char* const CFG_INT_CACHE_FILE_SIZE = "cacheFileSizeLimitInBytes";
/// <summary>
/// The RAM queue size limit in bytes.
/// </summary>
static constexpr const char* const CFG_INT_RAM_QUEUE_SIZE = "cacheMemorySizeLimitInBytes";
/// <summary>
/// The size of the RAM queue buffers, in bytes.
/// </summary>
static constexpr const char* const CFG_INT_RAM_QUEUE_BUFFERS = "maxDBFlushQueues";
/// <summary>
/// SQLite DB will be checkpointed when flushing.
/// </summary>
static constexpr const char* const CFG_BOOL_CHECKPOINT_DB_ON_FLUSH = "checkpointDBOnFlush";
/// <summary>
/// The trace level mask.
/// </summary>
static constexpr const char* const CFG_INT_TRACE_LEVEL_MASK = "traceLevelMask";
/// <summary>
/// The minimum trace level.
/// </summary>
static constexpr const char* const CFG_INT_TRACE_LEVEL_MIN = "minimumTraceLevel";
/// <summary>
/// Enable trace logs.
/// </summary>
static constexpr const char* const CFG_BOOL_ENABLE_TRACE = "enableTrace";
/// <summary>
/// The trace filepath.
/// </summary>
static constexpr const char* const CFG_STR_TRACE_FOLDER_PATH = "traceFolderPath";
/// <summary>
/// The SDK mode.
/// </summary>
static constexpr const char* const CFG_INT_SDK_MODE = "sdkmode";
/// <summary>
/// UTC lives at the root of all UTC-specific configuration.
/// </summary>
static constexpr const char* const CFG_STR_UTC = "utc";
/// <summary>
/// Sets the provider name when in UTC mode.
/// </summary>
static constexpr const char* const CFG_STR_UTC_PROVIDER_NAME = "providerName";
/// <summary>
/// Set the provider group directly with a string (which will be converted to a GUID).
/// </summary>
static constexpr const char* const CFG_STR_PROVIDER_GROUP_ID = "providerGroupId";
/// <summary>
/// Skip registering the iKey with UTC, so that a pre-existing provider can be used.
/// </summary>
static constexpr const char* const CFG_STR_SKIP_IKEY_REGISTRATION = "skipIKeyRegistration";
/// <summary>
/// The maximum teardown time.
/// </summary>
static constexpr const char* const CFG_INT_MAX_TEARDOWN_TIME = "maxTeardownUploadTimeInSec";
/// <summary>
/// Disable zombie logger logic.
/// </summary>
static constexpr const char* const CFG_BOOL_DISABLE_ZOMBIE_LOGGERS = "disableZombieLoggers";
/// <summary>
/// The maximum number of pending HTTP requests.
/// </summary>
static constexpr const char* const CFG_INT_MAX_PENDING_REQ = "maxPendingHTTPRequests";
/// <summary>
/// The maximum package drop on full.
/// </summary>
static constexpr const char* const CFG_INT_MAX_PKG_DROP_ON_FULL = "maxPkgDropOnFull";
/// <summary>
/// The cache file percentage full notification.
/// </summary>
static constexpr const char* const CFG_INT_STORAGE_FULL_PCT = "cacheFileFullNotificationPercentage";
/// <summary>
/// The minimum time (ms) between storage full notifications.
/// </summary>
static constexpr const char* const CFG_INT_STORAGE_FULL_CHECK_TIME = "cacheFullNotificationIntervalTime";
/// <summary>
/// The cache memory percentage full notification.
/// </summary>
static constexpr const char* const CFG_INT_RAMCACHE_FULL_PCT = "cacheMemoryFullNotificationPercentage";
/// <summary>
/// PRAGMA journal mode.
/// </summary>
static constexpr const char* const CFG_STR_PRAGMA_JOURNAL_MODE = "PRAGMA_journal_mode";
/// <summary>
/// PRAGMA synchronous.
/// </summary>
static constexpr const char* const CFG_STR_PRAGMA_SYNCHRONOUS = "PRAGMA_synchronous";
static constexpr const char* const CFG_STR_PRIMARY_TOKEN = "primaryToken";
/// <summary>
/// Parameter that allows to apply custom transmit profile on SDK start
/// </summary>
static constexpr const char* const CFG_STR_START_PROFILE_NAME = "startProfileName";
/// <summary>
/// Parameter that allows to load a set of custom transmit profile on SDK start
/// </summary>
static constexpr const char* const CFG_STR_TRANSMIT_PROFILES = "transmitProfiles";
/// <summary>
/// IHttpClient override module
/// </summary>
static constexpr const char* const CFG_MODULE_HTTP_CLIENT = "httpClient";
/// <summary>
/// ITaskDispatcher override module
/// </summary>
static constexpr const char* const CFG_MODULE_TASK_DISPATCHER = "taskDispatcher";
/// <summary>
/// IDataViewer override module
/// </summary>
static constexpr const char* const CFG_MODULE_DATA_VIEWER = "dataViewer";
/// <summary>
/// IDecorator override module
/// </summary>
static constexpr const char* const CFG_MODULE_DECORATOR = "decorator";
/// <summary>
/// IDecorator override module
/// </summary>
static constexpr const char* const CFG_MODULE_PRIVACY_GUARD = "privacy_guard";
/// <summary>
/// IDecorator override module
/// </summary>
static constexpr const char* const CFG_MODULE_OFFLINE_STORAGE = "offlineStorage";
/// <summary>
/// Pointer to the Android app's JavaVM
/// </summary>
static constexpr const char* const CFG_PTR_ANDROID_JVM = "android_jvm";
/// <summary>
/// JObject of the Android app's main activity
/// </summary>
static constexpr const char* const CFG_JOBJECT_ANDROID_ACTIVITY = "android_activity";
/// <summary>
/// LogManagerFactory's name parameter
/// </summary>
static constexpr const char* const CFG_STR_FACTORY_NAME = "name";
/// <summary>
/// LogManagerFactory (and friends) config map
/// </summary>
static constexpr const char* const CFG_MAP_FACTORY_CONFIG = "config";
/// <summary>
/// sub-component in CFG_MAP_FACTORY_CONFIG: LogManagerFactory host parameter
/// </summary>
static constexpr const char* const CFG_STR_FACTORY_HOST = "host";
/// <summary>
/// sub-component in CFG_MAP_FACTORY_CONFIG: capi's scope parameter
/// </summary>
static constexpr const char* const CFG_STR_CONTEXT_SCOPE = "scope";
/// <summary>
/// MetaStats configuration
/// </summary>
static constexpr const char* const CFG_MAP_METASTATS_CONFIG = "stats";
/// <summary>
/// MetaStats configuration: time interval
/// </summary>
static constexpr const char* const CFG_INT_METASTATS_INTERVAL = "interval";
/// <summary>
/// MetaStats configuration: time interval
/// </summary>
static constexpr const char* const CFG_BOOL_METASTATS_SPLIT = "split";
/// <summary>
/// Compatibility configuration
/// </summary>
static constexpr const char* const CFG_MAP_COMPAT = "compat";
/// <summary>
/// Compatibility configuration: dot mode
/// </summary>
static constexpr const char* const CFG_BOOL_COMPAT_DOTS = "dotType";
/// <summary>
/// Compatibility configuration: custom type prefix. Default value: "custom"
/// </summary>
static constexpr const char* const CFG_STR_COMPAT_PREFIX = "customTypePrefix";
/// <summary>
/// LogManagerFactory: is this log manager instance in host mode?
/// </summary>
static constexpr const char* const CFG_BOOL_HOST_MODE = "hostMode";
/// <summary>
/// HTTP configuration map
/// </summary>
static constexpr const char* const CFG_MAP_HTTP = "http";
/// <summary>
/// HTTP configuration map: MS root check
/// </summary>
static constexpr const char* const CFG_BOOL_HTTP_MS_ROOT_CHECK = "msRootCheck";
/// <summary>
/// HTTP configuration: compression
/// </summary>
static constexpr const char* const CFG_BOOL_HTTP_COMPRESSION = "compress";
/// <summary>
/// TPM configuration map
/// </summary>
static constexpr const char* const CFG_MAP_TPM = "tpm";
/// <summary>
/// TPM configuration: max retry
/// </summary>
static constexpr const char* const CFG_INT_TPM_MAX_RETRY = "maxRetryCount";
/// <summary>
/// TPM configuration map
/// </summary>
static constexpr const char* const CFG_STR_TPM_BACKOFF = "backoffConfig";
/// <summary>
/// TPM configuration map
/// </summary>
static constexpr const char* const CFG_INT_TPM_MAX_BLOB_BYTES = "maxBlobSize";
/// <summary>
/// TPM configuration map
/// </summary>
static constexpr const char* const CFG_BOOL_TPM_CLOCK_SKEW_ENABLED = "clockSkewEnabled";
/// <summary>
/// When enabled, the session timer is reset after session is completed, allowing for several session events in the duration of the SDK lifecycle
/// </summary>
static constexpr const char* const CFG_BOOL_SESSION_RESET_ENABLED = "sessionResetEnabled";
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
/// <summary>
/// The ILogConfiguration class contains LogManager-specific configuration settings
/// </summary>
class MATSDK_LIBABI ILogConfiguration
{
public:
/// <summary>
/// Construct an empty configuration
/// </summary>
ILogConfiguration() = default;
/// <summary>
/// Construct a pre-populated configuration
/// </summary>
/// <param name="initList">Initializer list of key/value config settings</param>
ILogConfiguration(const std::initializer_list<VariantMap::value_type>& initList);
/// <summary>
/// Add a module to the log configuration
/// </summary>
/// <param name="key">Module name</param>
/// <param name="module">Module instance</param>
void AddModule(const char* key, const std::shared_ptr<IModule>& module);
/// <summary>
/// Get a module by name
/// </summary>
/// <param name="key">Module name</param>
/// <returns>Module instance if set, else null</returns>
std::shared_ptr<IModule> GetModule(const char* key);
/// <summary>
/// Access underlying modules map
/// </summary>
std::map<std::string, std::shared_ptr<IModule>>& GetModules();
/// <summary>
/// Check if a config value has been set
/// </summary>
/// <param name="key">Config name</param>
/// <returns>True if config value exists, else false</returns>
bool HasConfig(const char* key);
/// <summary>
/// Get a config value by name, creating a new value if one doesn't already exist
/// </summary>
/// <param name="key">Config name</param>
/// <returns>Config value</returns>
Variant& operator[](const char* key);
/// <summary>
/// Access underlying VariantMap
/// </summary>
VariantMap& operator*();
private:
VariantMap m_configs;
std::map<std::string, std::shared_ptr<IModule>> m_modules;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
MAT_NS_END
#endif