Skip to content

Commit

Permalink
Adding debugLog() function
Browse files Browse the repository at this point in the history
  • Loading branch information
simsekgokhan committed Aug 4, 2020
1 parent 7a8b441 commit d5780a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/robomongo/core/utils/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@
#include "robomongo/core/AppRegistry.h"
#include "robomongo/core/domain/App.h"
#include "robomongo/core/EventBus.h"
#include "robomongo/core/settings/SettingsManager.h"
#include "robomongo/core/utils/QtUtils.h"

namespace Robomongo
{
void sendLog(
QObject *sender, LogEvent::LogLevel const& severity,
std::string const& msg, bool const informUser /*= false*/)
{
AppRegistry::instance().bus()->send(
AppRegistry::instance().app(),
new LogEvent(sender, msg, severity, informUser)
);
}

Logger::Logger()
{
QFile file {
Expand Down Expand Up @@ -58,4 +49,21 @@ namespace Robomongo
}
emit printed(logLevelStr + msg.simplified(), level);
}

void sendLog(
QObject *sender, LogEvent::LogLevel const& severity,
std::string const& msg, bool const informUser /*= false*/)
{
AppRegistry::instance().bus()->send(
AppRegistry::instance().app(),
new LogEvent(sender, msg, severity, informUser)
);
}

void debugLog(std::string_view msg) {
if (!AppRegistry::instance().settingsManager()->debugMode())
return;

std::cout << msg << std::endl;
}
}
2 changes: 2 additions & 0 deletions src/robomongo/core/utils/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ namespace Robomongo
QObject *sender, LogEvent::LogLevel const& severity,
std::string const& msg, bool const informUser = false
);

void debugLog(std::string_view msg);
}

0 comments on commit d5780a0

Please sign in to comment.