Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix findings
  • Loading branch information
kullingk committed Aug 22, 2025
commit 85a8c28fa89a4fdef8c8fac6cb7bd20deae27b25
17 changes: 5 additions & 12 deletions code/Common/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------------------------*/
#include <cppcore/Common/Logger.h>

#include <cassert>
#include <iomanip>
#include <iostream>
Expand All @@ -29,9 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

namespace cppcore {

static constexpr char Line[] =
"====================================================================================================";

static void appendDomain(const String &domain, String &logMsg) {
if (!domain.isEmpty()) {
logMsg += '(';
Expand Down Expand Up @@ -153,10 +151,8 @@ void Logger::print(const String &msg, PrintMode mode) {
return;
}

if (msg.size() > 8) {
if (msg[6] == '<' && msg[7] == '=') {
mIntention -= 2;
}
if (msg.size() > 8 && msg[6] == '<' && msg[7] == '=') {
mIntention -= 2;
}

String logMsg;
Expand Down Expand Up @@ -236,10 +232,7 @@ void Logger::unregisterLogStream(AbstractLogStream *logStream) {
}
}

Logger::Logger() :
mLogStreams(),
mVerboseMode(VerboseMode::Normal),
mIntention(0) {
Logger::Logger() {
mLogStreams.add(new StdLogStream);
}

Expand All @@ -250,7 +243,7 @@ Logger::~Logger() {
}

String Logger::getDateTime() {
static const uint32_t Space = 2;
//static const uint32_t Space = 2;
/* DateTime currentDateTime = DateTime::getCurrentUTCTime();
std::stringstream stream;
stream.fill('0');
Expand Down
8 changes: 4 additions & 4 deletions include/cppcore/Common/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using String = TStringBase<char>;
/// or a log window in a GUI application. Implement the write message and attach a valid instance
/// to the logger itself to use your own implementation.
//-------------------------------------------------------------------------------------------------
class AbstractLogStream {
class DLL_CPPCORE_EXPORT AbstractLogStream {
public:
/// @brief The default class destructor, virtual.
virtual ~AbstractLogStream() = default;
Expand Down Expand Up @@ -81,7 +81,7 @@ class AbstractLogStream {
/// supported modes are normal ( no debug and info messages ), verbose ( all messages will be
/// logged ) and debug ( the debug messages will be logged as well, be careful with this option ).
//-------------------------------------------------------------------------------------------------
class Logger final {
class DLL_CPPCORE_EXPORT Logger final {
public:
/// @brief Describes the verbode mode.
enum class VerboseMode {
Expand Down Expand Up @@ -189,8 +189,8 @@ class Logger final {

using LogStreamArray = cppcore::TArray<AbstractLogStream*>;
LogStreamArray mLogStreams;
VerboseMode mVerboseMode;
uint32_t mIntention;
VerboseMode mVerboseMode{VerboseMode::Normal};
uint32_t mIntention{0};
};

// Logger helper function prototypes
Expand Down