Skip to content

Commit

Permalink
Log#Log(): require passing one involved object
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Aug 15, 2023
1 parent a38272f commit 8518c64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/base/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ void Logger::UpdateCheckObjectFilterCache()
m_ObjectFilterCache.swap(allObjects);
}

Log::Log(LogSeverity severity, String facility, const String& message)
: m_Severity(severity), m_Facility(std::move(facility)), m_IsNoOp(severity < Logger::GetMinLogSeverity())
Log::Log(LogSeverity severity, String facility, const ConfigObject::Ptr& involved, const String& message)
: m_Severity(severity), m_Facility(std::move(facility)),
m_Involved(involved), m_IsNoOp(severity < Logger::GetMinLogSeverity())
{
if (!m_IsNoOp && !message.IsEmpty()) {
m_Buffer << message;
Expand Down
4 changes: 3 additions & 1 deletion lib/base/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "base/atomic.hpp"
#include "base/i2-base.hpp"
#include "base/configobject.hpp"
#include "base/logger-ti.hpp"
#include <set>
#include <sstream>
Expand Down Expand Up @@ -122,7 +123,7 @@ class Log
Log(const Log& other) = delete;
Log& operator=(const Log& rhs) = delete;

Log(LogSeverity severity, String facility, const String& message = String());
Log(LogSeverity severity, String facility, const ConfigObject::Ptr& involved, const String& message = String());
~Log();

template<typename T>
Expand All @@ -137,6 +138,7 @@ class Log
private:
LogSeverity m_Severity;
String m_Facility;
ConfigObject::Ptr m_Involved;
std::ostringstream m_Buffer;
bool m_IsNoOp;
};
Expand Down

0 comments on commit 8518c64

Please sign in to comment.