Skip to content

Commit 9444363

Browse files
Merge branch '123-logger-rule-zero' into 125-fix-sonar-issues
2 parents cdb0516 + 5dbab14 commit 9444363

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
2.3.0
2+
- make logger::logger rule zero compliant (#123)
23
- write more logger::sink tests (#124)
34
- fixed a bug in ./tests/CMakeLists.txt that prevented exception_tests to be run (#121)
45
- activate soanrcloud checks (#120)

cmake/SonarCloudConfig.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if ( SONAR )
4848
message(SEND_ERROR "Failed to find the program [sonar_scanner], make sure sonar tools are installed.")
4949
endif()
5050

51-
else()
52-
message(WARNING "SONAR cloud build is turned off, use -DSONAR=yes to turn in ON")
51+
#else()
52+
# message(WARNING "SONAR cloud build is turned off, use -DSONAR=yes to turn in ON")
5353
endif()
5454

include/logger/logger.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,9 @@ namespace logger {
190190
*/
191191
logger( const std::string &name, sink *sink);
192192

193-
/** dispose of logger's ressources
194-
*/
195-
virtual ~logger();
196-
197193
private:
198194

199-
sink *_sink; //!< logger delegate to a sink the actual magic to write log messages
195+
std::unique_ptr<sink> _sink; //!< logger delegate to a sink the actual magic to write log messages
200196

201197
std::string _name; //!< logger's name
202198
}; // logger

src/logger.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,8 @@ namespace logger {
1414
// constructors & destructors -------------------------------------
1515
//
1616

17-
logger::logger(const std::string &name, sink *sink) : _sink(NULL), _name (name) {
18-
_sink = sink;
19-
}
20-
21-
logger::~logger() {
22-
// printf("DEBUG %s destructor (%s,%d).\n", __FUNCTION__, __FILE__, __LINE__);
23-
if (_sink != NULL) {
24-
delete _sink;
25-
}
17+
logger::logger(const std::string &name, sink *sink) : _name (name) {
18+
_sink.reset(sink);
2619
}
2720

2821
std::string logger::ecid() {

0 commit comments

Comments
 (0)