Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/example_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int main() {
string _serverUrl = "https://your.server.ly";

if(_appKey.compare("YOUR_APP_KEY") == 0 || _serverUrl.compare("https://your.server.ly") == 0) {
cerr << "Please do not use default set of app key and server url" << endl;
printLog(LogLevel::WARNING, "[ExampleIntegration] Please do not use default set of app key and server url");
}

ct.start(_appKey, _serverUrl, 443, true);
Expand Down Expand Up @@ -276,7 +276,7 @@ int main() {
flag = false;
break;
default:
cout << "Option not found!" << endl;
printLog(LogLevel::DEBUG, "[ExampleIntegration] Please do not use default set of app key and server url");
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/countly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class Countly : public cly::CountlyDelegates {
/* Provide 'updateInterval' in seconds. */
inline void setAutomaticSessionUpdateInterval(unsigned short updateInterval) {
if (is_sdk_initialized) {
log(LogLevel::WARNING, "[Countly][setAutomaticSessionUpdateInterval] You can not set the session duration after SDK initialization.");
log(LogLevel::WARNING, "[Countly]setAutomaticSessionUpdateInterval, You can not set the session duration after SDK initialization.");
return;
}

Expand Down
24 changes: 12 additions & 12 deletions src/configuration_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,19 @@ class ConfigurationModule::ConfigurationModuleImpl {
sanitizeConfig(response.data[KEY_CONFIG]);
sdk_behavior_settings = response.data[KEY_CONFIG];
_storageModule->storeSDKBehaviorSettings(sdk_behavior_settings.dump());
_logger->log(LogLevel::INFO, "[ConfigurationModule] _fetchConfigFromServerHTTP, SDK config:\n" + sdk_behavior_settings.dump(2));
_logger->log(LogLevel::INFO, "[Countly] [ConfigurationModule] _fetchConfigFromServerHTTP, SDK config:\n" + sdk_behavior_settings.dump(2));
changedSettings = _populateConfigValues();
}
_onSBSChanged(changedSettings, session_params);
} else {
_logger->log(LogLevel::WARNING,
"[ConfigurationModule] _fetchConfigFromServerHTTP, failed to fetch."
"[Countly] [ConfigurationModule] _fetchConfigFromServerHTTP, failed to fetch."
" success=" +
std::string(response.success ? "true" : "false") + ", is_object=" + std::string(response.data.is_object() ? "true" : "false") +
", has_config=" + std::string((response.data.is_object() && response.data.contains(KEY_CONFIG)) ? "true" : "false") + ", response=" + response.data.dump());
}
} catch (const std::exception &e) {
_logger->log(LogLevel::ERROR, "[ConfigurationModule] _fetchConfigFromServerHTTP, exception: " + std::string(e.what()));
_logger->log(LogLevel::ERROR, "[Countly] [ConfigurationModule] _fetchConfigFromServerHTTP, exception: [" + std::string(e.what()) + "]");
}
}

Expand All @@ -169,13 +169,13 @@ class ConfigurationModule::ConfigurationModuleImpl {
std::string sbs_string = _storageModule->getSDKBehaviorSettings();
if (!sbs_string.empty()) {
nlohmann::json changed = _processSDKBehaviorSettings(sbs_string);
_logger->log(LogLevel::INFO, "[ConfigurationModule] _initializeSBSFromStorage, initialized SDK behavior settings from storage.");
_logger->log(LogLevel::INFO, "[Countly] [ConfigurationModule] _initializeSBSFromStorage, initialized SDK behavior settings from storage.");
return changed;
} else if (!_configuration->sdkBehaviorSettings.empty()) {
nlohmann::json changed = _processSDKBehaviorSettings(_configuration->sdkBehaviorSettings);
// Persist the provided SBS so it's available on future re-inits
_storageModule->storeSDKBehaviorSettings(sdk_behavior_settings.dump());
_logger->log(LogLevel::INFO, "[ConfigurationModule] _initializeSBSFromStorage, initialized SDK behavior settings from configuration.");
_logger->log(LogLevel::INFO, "[Countly] [ConfigurationModule] _initializeSBSFromStorage, initialized SDK behavior settings from configuration.");
return changed;
}
return nlohmann::json{};
Expand All @@ -192,10 +192,10 @@ class ConfigurationModule::ConfigurationModuleImpl {
nlohmann::json sbs_json = nlohmann::json::parse(settings);
sanitizeConfig(sbs_json);
sdk_behavior_settings = sbs_json;
_logger->log(LogLevel::INFO, "[ConfigurationModule] _processSDKBehaviorSettings, SDK config:\n" + sdk_behavior_settings.dump(2));
_logger->log(LogLevel::INFO, "[Countly] [ConfigurationModule] _processSDKBehaviorSettings, SDK config:\n" + sdk_behavior_settings.dump(2));
return _populateConfigValues();
} catch (const nlohmann::json::parse_error &e) {
_logger->log(LogLevel::ERROR, "[ConfigurationModule] _processSDKBehaviorSettings, Failed to parse SDK behavior settings: " + std::string(e.what()));
_logger->log(LogLevel::ERROR, "[Countly] [ConfigurationModule] _processSDKBehaviorSettings, Failed to parse SDK behavior settings: [" + std::string(e.what()) + "]");
return nlohmann::json{};
}
}
Expand Down Expand Up @@ -308,7 +308,7 @@ class ConfigurationModule::ConfigurationModuleImpl {
continue;
}
} else {
_logger->log(LogLevel::DEBUG, "[ConfigurationModule] sanitizeConfig, removing unknown key: " + key);
_logger->log(LogLevel::DEBUG, "[Countly] [ConfigurationModule] sanitizeConfig, removing unknown key: [" + key + "]");
it = c.erase(it);
continue;
}
Expand Down Expand Up @@ -348,7 +348,7 @@ class ConfigurationModule::ConfigurationModuleImpl {
_fetchConfigFromServerHTTP(data, session_params);
lock.lock();
} catch (const std::exception &e) {
_logger->log(LogLevel::ERROR, "[ConfigurationModule] _updateConfigPeriodically, exception: " + std::string(e.what()));
_logger->log(LogLevel::ERROR, "[Countly] [ConfigurationModule] _updateConfigPeriodically, exception: [" + std::string(e.what()) + "]");
if (!lock.owns_lock()) {
lock.lock();
}
Expand All @@ -357,7 +357,7 @@ class ConfigurationModule::ConfigurationModuleImpl {
}

void _stopTimer() {
_logger->log(LogLevel::WARNING, "[ConfigurationModule] stopTimer, stopping server config update timer thread.");
_logger->log(LogLevel::WARNING, "[Countly] [ConfigurationModule] stopTimer, stopping server config update timer thread.");
stopConfigThread.store(true, std::memory_order_release);
configUpdateCv.notify_all();

Expand All @@ -368,7 +368,7 @@ class ConfigurationModule::ConfigurationModuleImpl {

void _startTimer(nlohmann::json session_params) {
if (_configuration->sdkBehaviorSettingsUpdatesDisabled) {
_logger->log(LogLevel::INFO, "[ConfigurationModule] _startTimer, SDK behavior settings updates are disabled.");
_logger->log(LogLevel::INFO, "[Countly] [ConfigurationModule] _startTimer, SDK behavior settings updates are disabled.");
return;
}

Expand Down Expand Up @@ -422,7 +422,7 @@ class ConfigurationModule::ConfigurationModuleImpl {
ConfigurationModule::ConfigurationModule(cly::CountlyDelegates *cly, std::shared_ptr<CountlyConfiguration> config, std::shared_ptr<LoggerModule> logger, std::shared_ptr<RequestBuilder> requestBuilder, std::shared_ptr<StorageModuleBase> storageModule, std::shared_ptr<RequestModule> requestModule,
std::shared_ptr<std::mutex> mutex) {
impl.reset(new ConfigurationModuleImpl(cly, config, logger, requestBuilder, storageModule, requestModule, mutex));
impl->_logger->log(LogLevel::DEBUG, "[ConfigurationModule] Initialized");
impl->_logger->log(LogLevel::DEBUG, "[Countly] [ConfigurationModule] Initialized");
}

ConfigurationModule::~ConfigurationModule() { impl.reset(); }
Expand Down
Loading
Loading