vwo-sdk 1.29.1 → 1.36.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require_relative '../logger'
16
15
  require_relative '../enums'
17
16
  require_relative '../constants'
17
+ require_relative './log_message'
18
18
 
19
19
  # Utility module for processing VWO campaigns
20
20
  class VWO
@@ -41,18 +41,17 @@ class VWO
41
41
  variation['start_variation_allocation'] = -1
42
42
  variation['end_variation_allocation'] = -1
43
43
  end
44
-
45
- VWO::Logger.get_instance.log(
46
- LogLevelEnum::INFO,
47
- format(
48
- LogMessageEnum::InfoMessages::VARIATION_RANGE_ALLOCATION,
49
- file: FileNameEnum::CampaignUtil,
50
- campaign_key: campaign['key'],
51
- variation_name: variation['name'],
52
- variation_weight: variation['weight'],
53
- start: variation['start_variation_allocation'],
54
- end: variation['end_variation_allocation']
55
- )
44
+ Logger.log(
45
+ LogLevelEnum::DEBUG,
46
+ 'VARIATION_RANGE_ALLOCATION',
47
+ {
48
+ '{file}' => FileNameEnum::CampaignUtil,
49
+ '{campaignKey}' => campaign['key'],
50
+ '{variationName}' => variation['name'],
51
+ '{variationWeight}' => variation['weight'],
52
+ '{start}' => variation['start_variation_allocation'],
53
+ '{end}' => variation['end_variation_allocation']
54
+ }
56
55
  )
57
56
  end
58
57
  end
@@ -183,13 +182,13 @@ class VWO
183
182
  end
184
183
  end
185
184
  if campaigns.length() == 0
186
- VWO::Logger.get_instance.log(
185
+ Utils::Logger.log(
187
186
  LogLevelEnum::ERROR,
188
- format(
189
- LogMessageEnum::ErrorMessages::NO_CAMPAIGN_FOUND,
190
- file: FileNameEnum::CampaignUtil,
191
- goal_identifier: goal_identifier
192
- )
187
+ 'CAMPAIGN_NOT_FOUND_FOR_GOAL',
188
+ {
189
+ '{file}' => FileNameEnum::CampaignUtil,
190
+ '{goalIdentifier}' => goal_identifier
191
+ }
193
192
  )
194
193
  end
195
194
  return campaigns
@@ -255,14 +254,14 @@ class VWO
255
254
  def get_running_campaign(campaign_key, settings_file)
256
255
  campaign = get_campaign(settings_file, campaign_key)
257
256
  if campaign.nil? || (campaign['status'] != 'RUNNING')
258
- @logger.log(
259
- LogLevelEnum::ERROR,
260
- format(
261
- LogMessageEnum::ErrorMessages::CAMPAIGN_NOT_RUNNING,
262
- file: FILE,
263
- campaign_key: campaign_key,
264
- api_name: ApiMethods::TRACK
265
- )
257
+ Utils::Logger.log(
258
+ LogLevelEnum::WARNING,
259
+ 'CAMPAIGN_NOT_RUNNING',
260
+ {
261
+ '{file}' => FILE,
262
+ '{campaignKey}' => campaign_key,
263
+ '{api}' => ApiMethods::TRACK
264
+ }
266
265
  )
267
266
  nil
268
267
  end
@@ -13,11 +13,11 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require 'json'
16
- require_relative '../logger'
17
16
  require_relative '../enums'
18
17
  require_relative '../constants'
19
18
  require_relative './impression'
20
19
  require_relative './utility'
20
+ require_relative './log_message'
21
21
 
22
22
  # Utility module for helper math and random functions
23
23
  class VWO
@@ -36,13 +36,13 @@ class VWO
36
36
  params = get_common_properties(user_id, settings_file)
37
37
  params.merge!('url' => url, 'tags' => JSON.generate(tag), 'env' => sdk_key)
38
38
 
39
- VWO::Logger.get_instance.log(
39
+ Logger.log(
40
40
  LogLevelEnum::DEBUG,
41
- format(
42
- LogMessageEnum::DebugMessages::PARAMS_FOR_PUSH_CALL,
43
- file: FileNameEnum::CustomDimensionsUtil,
44
- properties: remove_sensitive_properties(params)
45
- )
41
+ 'IMPRESSION_FOR_PUSH',
42
+ {
43
+ '{file}' => FileNameEnum::CustomDimensionsUtil,
44
+ '{properties}' => JSON.generate(params)
45
+ }
46
46
  )
47
47
  params
48
48
  end
@@ -55,17 +55,17 @@ class VWO
55
55
  params = {
56
56
  'eT' => 3,
57
57
  't' => JSON.generate(tag),
58
- 'u' => generator_for(user_id, account_id),
58
+ 'u' => generator_for(user_id, account_id, true),
59
59
  'sId' => get_current_unix_timestamp
60
60
  }
61
61
 
62
- VWO::Logger.get_instance.log(
62
+ Logger.log(
63
63
  LogLevelEnum::DEBUG,
64
- format(
65
- LogMessageEnum::DebugMessages::PARAMS_FOR_PUSH_CALL,
66
- file: FileNameEnum::CustomDimensionsUtil,
67
- properties: JSON.generate(params)
68
- )
64
+ 'IMPRESSION_FOR_PUSH',
65
+ {
66
+ '{file}' => FileNameEnum::CustomDimensionsUtil,
67
+ '{properties}' => JSON.generate(params)
68
+ }
69
69
  )
70
70
  params
71
71
  end
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require_relative '../logger'
16
15
  require_relative '../enums'
17
16
  require_relative '../constants'
17
+ require_relative './log_message'
18
18
 
19
19
  # Utility module for helper math and random functions
20
20
  class VWO
@@ -41,15 +41,12 @@ class VWO
41
41
 
42
42
  return value if variable_type == VariableTypes::JSON
43
43
  rescue StandardError => _e
44
- VWO::Logger.get_instance.log(
44
+ Logger.log(
45
45
  LogLevelEnum::ERROR,
46
- format(
47
- LogMessageEnum::ErrorMessages::UNABLE_TO_TYPE_CAST,
48
- file: FileNameEnum::FeatureUtil,
49
- value: value,
50
- variable_type: variable_type,
51
- of_type: value.class.name
52
- )
46
+ 'unable to type cast variable value: ' + _e.message,
47
+ {
48
+ '{file}' => FILE
49
+ }
53
50
  )
54
51
  nil
55
52
  end
@@ -14,9 +14,9 @@
14
14
 
15
15
  require 'json'
16
16
  require 'cgi'
17
- require_relative '../logger'
18
17
  require_relative '../enums'
19
18
  require_relative '../constants'
19
+ require_relative './log_message'
20
20
  require_relative 'function'
21
21
  require_relative 'uuid'
22
22
  require_relative 'utility'
@@ -57,7 +57,7 @@ class VWO
57
57
  combination: variation_id,
58
58
  random: get_random_number,
59
59
  sId: get_current_unix_timestamp,
60
- u: generator_for(user_id, account_id),
60
+ u: generator_for(user_id, account_id, true),
61
61
  env: sdk_key
62
62
  }
63
63
  # Version and SDK constants
@@ -72,25 +72,25 @@ class VWO
72
72
  if is_track_user_api
73
73
  impression['ed'] = JSON.generate(p: 'server')
74
74
  impression['url'] = HTTPS_PROTOCOL + get_url(ENDPOINTS::TRACK_USER)
75
- logger.log(
75
+ Logger.log(
76
76
  LogLevelEnum::DEBUG,
77
- format(
78
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_USER,
79
- file: FileNameEnum::ImpressionUtil,
80
- properties: remove_sensitive_properties(impression)
81
- )
77
+ 'IMPRESSION_FOR_TRACK_USER',
78
+ {
79
+ '{file}' => FileNameEnum::ImpressionUtil,
80
+ '{properties}' => remove_sensitive_properties(impression)
81
+ }
82
82
  )
83
83
  else
84
84
  impression['url'] = HTTPS_PROTOCOL + get_url(ENDPOINTS::TRACK_GOAL)
85
85
  impression['goal_id'] = goal_id
86
86
  impression['r'] = revenue if revenue
87
- logger.log(
87
+ Logger.log(
88
88
  LogLevelEnum::DEBUG,
89
- format(
90
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_GOAL,
91
- file: FileNameEnum::ImpressionUtil,
92
- properties: remove_sensitive_properties(impression)
93
- )
89
+ 'IMPRESSION_FOR_TRACK_GOAL',
90
+ {
91
+ '{file}' => FileNameEnum::ImpressionUtil,
92
+ '{properties}' => JSON.generate(impression)
93
+ }
94
94
  )
95
95
  end
96
96
  impression
@@ -110,7 +110,7 @@ class VWO
110
110
  'sdk-v' => SDK_VERSION,
111
111
  'ap' => PLATFORM,
112
112
  'sId' => get_current_unix_timestamp,
113
- 'u' => generator_for(user_id, account_id),
113
+ 'u' => generator_for(user_id, account_id, true),
114
114
  'account_id' => account_id
115
115
  }
116
116
  end
@@ -136,29 +136,29 @@ class VWO
136
136
  eT: is_track_user_api ? 1 : 2,
137
137
  e: campaign_id,
138
138
  c: variation_id,
139
- u: generator_for(user_id, account_id),
139
+ u: generator_for(user_id, account_id, true),
140
140
  sId: get_current_unix_timestamp
141
141
  }
142
142
  logger = VWO::Logger.get_instance
143
143
  if is_track_user_api
144
- logger.log(
144
+ Logger.log(
145
145
  LogLevelEnum::DEBUG,
146
- format(
147
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_USER,
148
- file: FileNameEnum::ImpressionUtil,
149
- properties: JSON.generate(impression)
150
- )
146
+ 'IMPRESSION_FOR_TRACK_USER',
147
+ {
148
+ '{file}' => FileNameEnum::ImpressionUtil,
149
+ '{properties}' => remove_sensitive_properties(impression)
150
+ }
151
151
  )
152
152
  else
153
153
  impression['g'] = goal_id
154
154
  impression['r'] = revenue if revenue
155
- logger.log(
155
+ Logger.log(
156
156
  LogLevelEnum::DEBUG,
157
- format(
158
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_GOAL,
159
- file: FileNameEnum::ImpressionUtil,
160
- properties: JSON.generate(impression)
161
- )
157
+ 'IMPRESSION_FOR_TRACK_GOAL',
158
+ {
159
+ '{file}' => FileNameEnum::ImpressionUtil,
160
+ '{properties}' => JSON.generate(impression)
161
+ }
162
162
  )
163
163
  end
164
164
  impression
@@ -171,7 +171,7 @@ class VWO
171
171
  # @param[String] :event_name
172
172
  # @param[Hash] :usage_stats
173
173
  # @return[Hash] :properties
174
- #
174
+ #
175
175
  def get_events_base_properties(settings_file, event_name, usage_stats = {})
176
176
  properties = {
177
177
  en: event_name,
@@ -195,9 +195,9 @@ class VWO
195
195
  # @param[String] :event_name
196
196
  # @param[Hash] :usage_stats
197
197
  # @return[Hash] :properties
198
- #
198
+ #
199
199
  def get_event_base_payload(settings_file, user_id, event_name, usage_stats = {})
200
- uuid = generator_for(user_id, (settings_file['accountId']))
200
+ uuid = generator_for(user_id, (settings_file['accountId']), true)
201
201
  sdk_key = settings_file['sdkKey']
202
202
 
203
203
  props = {
@@ -254,15 +254,15 @@ class VWO
254
254
  properties[:d][:event][:props][:isFirst] = 1
255
255
 
256
256
  logger = VWO::Logger.get_instance
257
- logger.log(
257
+ Logger.log(
258
258
  LogLevelEnum::DEBUG,
259
- format(
260
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_EVENT_ARCH_TRACK_USER,
261
- file: FileNameEnum::ImpressionUtil,
262
- a: settings_file['accountId'],
263
- u: user_id,
264
- c: campaign_id.to_s
265
- )
259
+ 'IMPRESSION_FOR_EVENT_ARCH_TRACK_USER',
260
+ {
261
+ '{file}' => FileNameEnum::ImpressionUtil,
262
+ '{accountId}' => settings_file['accountId'],
263
+ '{userId}' => user_id,
264
+ '{campaignId}' => campaign_id.to_s
265
+ }
266
266
  )
267
267
  properties
268
268
  end
@@ -285,16 +285,16 @@ class VWO
285
285
  metric = {}
286
286
  metric_map.each do |campaign_id, goal_id|
287
287
  metric[('id_' + campaign_id.to_s).to_sym] = ['g_' + goal_id.to_s]
288
- logger.log(
288
+ Logger.log(
289
289
  LogLevelEnum::DEBUG,
290
- format(
291
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_EVENT_ARCH_TRACK_GOAL,
292
- file: FileNameEnum::ImpressionUtil,
293
- goal_identifier: event_name,
294
- a: settings_file['accountId'],
295
- u: user_id,
296
- c: campaign_id
297
- )
290
+ 'IMPRESSION_FOR_EVENT_ARCH_TRACK_GOAL',
291
+ {
292
+ '{file}' => FileNameEnum::ImpressionUtil,
293
+ '{accountId}' => settings_file['accountId'],
294
+ '{goalName}' => event_name,
295
+ '{userId}' => user_id,
296
+ '{campaignId}' => campaign_id.to_s
297
+ }
298
298
  )
299
299
  end
300
300
 
@@ -331,18 +331,27 @@ class VWO
331
331
  end
332
332
 
333
333
  logger = VWO::Logger.get_instance
334
- logger.log(
334
+ Logger.log(
335
335
  LogLevelEnum::DEBUG,
336
- format(
337
- LogMessageEnum::DebugMessages::IMPRESSION_FOR_EVENT_ARCH_PUSH,
338
- file: FileNameEnum::ImpressionUtil,
339
- a: settings_file['accountId'],
340
- u: user_id,
341
- property: JSON.generate(custom_dimension_map)
342
- )
336
+ 'IMPRESSION_FOR_EVENT_ARCH_PUSH',
337
+ {
338
+ '{file}' => FileNameEnum::ImpressionUtil,
339
+ '{accountId}' => settings_file['accountId'],
340
+ '{userId}' => user_id,
341
+ '{property}' => JSON.generate(custom_dimension_map)
342
+ }
343
343
  )
344
344
  properties
345
345
  end
346
+
347
+ def get_batch_event_query_params(account_id, sdk_key, usage_stats = {})
348
+ return {
349
+ a: account_id,
350
+ sd: SDK_NAME,
351
+ sv: SDK_VERSION,
352
+ env: sdk_key
353
+ }.merge(usage_stats)
354
+ end
346
355
  end
347
356
  end
348
357
  end
@@ -0,0 +1,76 @@
1
+ # Copyright 2019-2022 Wingify Software Pvt. Ltd.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'vwo_log_messages'
16
+
17
+ require_relative '../logger'
18
+
19
+ class VWO
20
+ module Utils
21
+ class Logger
22
+
23
+ DEBUG = ::Logger::DEBUG
24
+ INFO = ::Logger::INFO
25
+ ERROR = ::Logger::ERROR
26
+ WARN = ::Logger::WARN
27
+
28
+ @@logs = nil
29
+ @@api_name = 'api_name'
30
+
31
+ def self.set_api_name(api_name)
32
+ @@api_name = api_name
33
+ end
34
+
35
+ def self.get_log_message(logsType, message_type)
36
+ if @@logs.nil?
37
+ @@logs = VwoLogMessages.getMessage
38
+ end
39
+
40
+ if !@@logs[logsType].key?(message_type)
41
+ return message_type
42
+ end
43
+ return @@logs[logsType][message_type]
44
+ end
45
+
46
+ def self.log(level, message_type, params, disable_logs = false)
47
+ if disable_logs
48
+ return
49
+ end
50
+ if level == DEBUG
51
+ message = get_log_message('debug_logs', message_type)
52
+ elsif level == INFO
53
+ message = get_log_message('info_logs', message_type)
54
+ elsif level == ERROR
55
+ message = get_log_message('error_logs', message_type)
56
+ elsif level == WARN
57
+ message = get_log_message('warning_logs', message_type)
58
+ else
59
+ message = ""
60
+ end
61
+ message = message.dup
62
+
63
+ if message && !message.empty?
64
+ params.each {
65
+ |key, value|
66
+ if message.include? key
67
+ message[key.to_s]= value.to_s
68
+ end
69
+ }
70
+ end
71
+ message = '[' + @@api_name + '] ' + message
72
+ VWO::Logger.get_instance.log(level, message)
73
+ end
74
+ end
75
+ end
76
+ end
@@ -50,6 +50,13 @@ class VWO
50
50
  def get_url(endpoint)
51
51
  return DataLocationManager.get_instance().get_data_location + endpoint
52
52
  end
53
+
54
+ def prepare_push_response(custom_dimension_map, resp, result)
55
+ custom_dimension_map.each do |tag_key, tag_value|
56
+ result[tag_key] = resp
57
+ end
58
+ result
59
+ end
53
60
  end
54
61
  end
55
62
  end
@@ -13,9 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require 'digest'
16
- require_relative '../logger'
17
16
  require_relative '../enums'
18
17
  require_relative '../constants'
18
+ require_relative './log_message'
19
19
 
20
20
  # Utility module for generating uuid
21
21
  class VWO
@@ -53,10 +53,11 @@ class VWO
53
53
  #
54
54
  # @param[Integer|String] :user_id User identifier
55
55
  # @param[Integer|String] :account_id Account identifier
56
+ # @param[Boolean] :disable_logs if true, do not log log-message
56
57
  #
57
58
  # @return[Integer] Desired UUID
58
59
  #
59
- def generator_for(user_id, account_id)
60
+ def generator_for(user_id, account_id, disable_logs = false)
60
61
  user_id = user_id.to_s
61
62
  account_id = account_id.to_s
62
63
  user_id_namespace = generate(VWO_NAMESPACE, account_id)
@@ -64,15 +65,16 @@ class VWO
64
65
 
65
66
  desired_uuid = uuid_for_account_user_id.delete('-').upcase
66
67
 
67
- VWO::Logger.get_instance.log(
68
+ Logger.log(
68
69
  LogLevelEnum::DEBUG,
69
- format(
70
- LogMessageEnum::DebugMessages::UUID_FOR_USER,
71
- file: FileNameEnum::UuidUtil,
72
- user_id: user_id,
73
- account_id: account_id,
74
- desired_uuid: desired_uuid
75
- )
70
+ 'USER_UUID',
71
+ {
72
+ '{file}' => FILE,
73
+ '{userId}' => user_id,
74
+ '{accountId}' => account_id,
75
+ '{uuid}' => desired_uuid
76
+ },
77
+ disable_logs
76
78
  )
77
79
  desired_uuid
78
80
  end
@@ -15,13 +15,14 @@
15
15
  require 'json'
16
16
  require 'json-schema'
17
17
  require_relative '../schemas/settings_file'
18
- require_relative '../logger'
19
18
  require_relative '../enums'
20
19
  require_relative '../constants'
20
+ require_relative './log_message'
21
21
 
22
22
  class VWO
23
23
  module Utils
24
24
  module Validations
25
+ include Enums
25
26
  # Validates the settings_file
26
27
  # @param [Hash]: JSON object received from VWO server
27
28
  # must be JSON.
@@ -66,83 +67,90 @@ class VWO
66
67
  # Validates if the value passed batch_events has correct data type and values or not.
67
68
  #
68
69
  # Args: batch_events [Hash]: value to be tested
70
+ # api_name [String]: current api name
69
71
  #
70
72
  # @return: [Boolean]: True if all conditions are passed else False
71
- def is_valid_batch_event_settings(batch_events)
72
- logger = VWO::Logger.get_instance
73
+ def is_valid_batch_event_settings(batch_events, api_name)
73
74
  events_per_request = batch_events[:events_per_request]
74
75
  request_time_interval = batch_events[:request_time_interval]
75
76
 
76
77
  unless events_per_request || request_time_interval
77
- logger.log(
78
- VWO::LogLevelEnum::ERROR,
79
- format(
80
- VWO::LogMessageEnum::ErrorMessages::EVENT_BATCHING_INSUFFICIENT,
81
- file: VWO::FileNameEnum::ValidateUtil
82
- )
83
- )
78
+ invalid_config_log('batch_events', 'object', api_name)
84
79
  return false
85
80
  end
86
81
 
87
82
  if (request_time_interval && !valid_number?(request_time_interval))
88
- logger.log(
89
- VWO::LogLevelEnum::ERROR,
90
- format(
91
- VWO::LogMessageEnum::ErrorMessages::REQUEST_TIME_INTERVAL_INVALID,
92
- file: VWO::FileNameEnum::ValidateUtil
93
- )
94
- )
83
+ invalid_config_log('batch_events', 'object', api_name)
95
84
  return false
96
85
  end
97
86
 
98
87
  if (events_per_request && !valid_number?(events_per_request))
99
- logger.log(
100
- VWO::LogLevelEnum::ERROR,
101
- format(
102
- VWO::LogMessageEnum::ErrorMessages::EVENTS_PER_REQUEST_INVALID,
103
- file: VWO::FileNameEnum::ValidateUtil
104
- )
105
- )
88
+ invalid_config_log('batch_events', 'object', api_name)
106
89
  return false
107
90
  end
108
91
 
109
92
  if events_per_request && (events_per_request < VWO::MIN_EVENTS_PER_REQUEST || events_per_request > VWO::MAX_EVENTS_PER_REQUEST)
110
- logger.log(
111
- VWO::LogLevelEnum::ERROR,
112
- format(
113
- VWO::LogMessageEnum::ErrorMessages::EVENTS_PER_REQUEST_OUT_OF_BOUNDS,
114
- file: VWO::FileNameEnum::ValidateUtil,
115
- min_value: VWO::MIN_EVENTS_PER_REQUEST,
116
- max_value: VWO::MAX_EVENTS_PER_REQUEST
117
- )
118
- )
93
+ invalid_config_log('batch_events', 'object', api_name)
119
94
  return false
120
95
  end
121
96
 
122
97
  if request_time_interval && request_time_interval < VWO::MIN_REQUEST_TIME_INTERVAL
123
- logger.log(
124
- VWO::LogLevelEnum::ERROR,
125
- format(
126
- VWO::LogMessageEnum::ErrorMessages::REQUEST_TIME_INTERVAL_OUT_OF_BOUNDS,
127
- file: VWO::FileNameEnum::ValidateUtil,
128
- min_value: VWO::MIN_REQUEST_TIME_INTERVAL
129
- )
130
- )
98
+ invalid_config_log('batch_events', 'object', api_name)
131
99
  return false
132
100
  end
133
101
 
134
102
  if batch_events.key?(:flushCallback) && !batch_events[:flushCallback].is_a?(Method)
135
- logger.log(
136
- VWO::LogLevelEnum::ERROR,
137
- format(
138
- VWO::LogMessageEnum::ErrorMessages::FLUSH_CALLBACK_INVALID,
139
- file: VWO::FileNameEnum::ValidateUtil
140
- )
141
- )
103
+ invalid_config_log('batch_events', 'object', api_name)
142
104
  return false
143
105
  end
144
106
  true
145
107
  end
108
+
109
+ def validate_sdk_config?(user_storage, is_development_mode, api_name)
110
+ if is_development_mode
111
+ if [true, false].include? is_development_mode
112
+ valid_config_log('isDevelopmentMode', 'boolean')
113
+ else
114
+ invalid_config_log('isDevelopmentMode', 'boolean', api_name)
115
+ return false
116
+ end
117
+ end
118
+
119
+ if user_storage
120
+ if user_storage.is_a?(UserStorage)
121
+ valid_config_log('UserStorageService', 'object')
122
+ else
123
+ invalid_config_log('UserStorageService', 'object', api_name)
124
+ return false
125
+ end
126
+ end
127
+ true
128
+ end
129
+
130
+ def valid_config_log(parameter, type)
131
+ Logger.log(
132
+ LogLevelEnum::INFO,
133
+ 'CONFIG_PARAMETER_USED',
134
+ {
135
+ '{file}' => VWO::FileNameEnum::ValidateUtil,
136
+ '{parameter}' => parameter,
137
+ '{type}' => type
138
+ }
139
+ )
140
+ end
141
+
142
+ def invalid_config_log(parameter, type, api_name)
143
+ Logger.log(
144
+ LogLevelEnum::ERROR,
145
+ 'CONFIG_PARAMETER_INVALID',
146
+ {
147
+ '{file}' => VWO::FileNameEnum::ValidateUtil,
148
+ '{parameter}' => parameter,
149
+ '{type}' => type,
150
+ '{api}' => api_name
151
+ }
152
+ )
153
+ end
146
154
  end
147
155
  end
148
156
  end