Skip to content

Commit 90e1042

Browse files
[Sdk 921] LogLevel removed from Çountly (#82)
* namespace added on countly classes * Loglevel removed from countly change log updated * get logger method logic updated logger unit tets updated define added on 'getlogger' function logger unit tests moved out of 'Custom' check * COUNTLY_USE_CUSTOM_SHA256 added on getlogger function * COUNTLY_BUILD_TESTS define added on getLogger function * macros removed on 'getLogger' * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: ArtursKadikis <[email protected]>
1 parent 97bf227 commit 90e1042

File tree

7 files changed

+78
-77
lines changed

7 files changed

+78
-77
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
22.06.1
2+
* !! Major breaking change !! We are removing the 'LogLevel' enum out of the 'Countly' class which will change how that enum can be referenced. 'Countly::LogLevel' will not work, you will have to use 'cly::LogLevel' instead.
3+
14
22.06.0
25
* !! Major breaking change !! We are adding the 'cly' namespace on 'Countly' class which will change how that class can be referenced. 'Countly::' will not work, you will have to use 'cly::Countly::' instead.
36
* !! Major breaking change !! We are extracting the 'Event' class out of the 'Countly' class which will change how that class can be referenced. 'Countly::Event' will not work, you will have to use 'cly::Event' instead.

examples/example_integration.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
using namespace std;
88
using namespace cly;
99

10-
void printLog(Countly::LogLevel level, const string &msg) {
10+
void printLog(LogLevel level, const string &msg) {
1111
string lvl = "[DEBUG]";
1212
switch (level) {
13-
case Countly::LogLevel::DEBUG:
13+
case LogLevel::DEBUG:
1414
lvl = "[Debug]";
1515
break;
16-
case Countly::LogLevel::INFO:
16+
case LogLevel::INFO:
1717
lvl = "[INFO]";
1818
break;
19-
case Countly::LogLevel::WARNING:
19+
case LogLevel::WARNING:
2020
lvl = "[WARNING]";
2121
break;
22-
case Countly::LogLevel::FATAL:
22+
case LogLevel::FATAL:
2323
lvl = "[FATAL]";
2424
break;
2525
default:

include/countly.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ class Countly : public cly::CountlyDelegates {
4141

4242
void setSalt(const std::string &value);
4343

44-
enum LogLevel { DEBUG = 1, INFO = 2, WARNING = 3, ERROR = 4, FATAL = 5 };
45-
4644
void setLogger(void (*fun)(LogLevel level, const std::string &message));
4745

46+
47+
#ifdef COUNTLY_BUILD_TESTS
4848
/*
4949
This function should not be used as it will be removed in a future release. It is
5050
currently added as a temporary workaround.
5151
*/
52-
inline std::function<void(LogLevel, const std::string &)> getLogger() { return logger_function; }
52+
inline std::function<void(LogLevel, const std::string &)> getLogger() { return logger->getLogger(); }
53+
#endif
5354

5455
struct HTTPResponse {
5556
bool success;
@@ -237,7 +238,6 @@ class Countly : public cly::CountlyDelegates {
237238

238239
cly::SHA256Function sha256_function;
239240
HTTPClientFunction http_client_function;
240-
void (*logger_function)(LogLevel level, const std::string &message) = nullptr;
241241

242242
std::string host;
243243

include/countly/logger_module.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ class LoggerModule {
2020
*/
2121
void setLogger(LoggerFunction logger);
2222

23+
24+
/**
25+
* Get custom logger function.
26+
*/
27+
const LoggerFunction getLogger();
28+
2329
/**
2430
* Print important information.
2531
*

0 commit comments

Comments
 (0)