Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions casbin/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace casbin {

// Print formats using the default formats for its operands and logs the message.
template <typename T, typename... Object>
void Logger::Print(T arg, Object... objects) {
void Logger::Print(T const& arg, Object const&... objects) {
return;
}

// Printf formats according to a format specifier and logs the message.
template <typename... Object>
void Logger::Printf(std::string format, Object... objects) {
void Logger::Printf(std::string const& format, Object const&... objects) {
Print(objects...);
}

Expand Down
6 changes: 3 additions & 3 deletions include/casbin/log/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class Logger {

// Print formats using the default formats for its operands and logs the message.
template <typename T, typename... Object>
void Print(T arg, Object... objects);
void Print(T const& arg, Object const&... objects);

// Printf formats according to a format specifier and logs the message.
template <typename... Object>
void Printf(std::string, Object... objects);
void Printf(std::string const& format, Object const&... objects);
};

} // namespace casbin

#endif
#endif
6 changes: 3 additions & 3 deletions include/casbin/log/default_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class DefaultLogger : public Logger {
bool IsEnabled() { return m_enable; }

template <typename... Object>
void Print(Object... objects) {
void Print(Object const&... objects) {
if (m_enable) {
Print(objects...);
}
}

template <typename... Object>
void Print(std::string format, Object... objects) {
void Print(std::string const& format, Object const&... objects) {
if (m_enable) {
Printf(format, objects...);
}
Expand All @@ -28,4 +28,4 @@ class DefaultLogger : public Logger {

} // namespace casbin

#endif
#endif
6 changes: 3 additions & 3 deletions include/casbin/log/log_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ class LogUtil {

// LogPrint prints the log.
template <typename... Object>
static void LogPrint(Object... objects) {
static void LogPrint(Object const&... objects) {
s_logger.Print(objects...);
}

// LogPrintf prints the log with the format.
template <typename... Object>
static void LogPrintf(std::string format, Object... objects) {
static void LogPrintf(std::string const& format, Object const&... objects) {
s_logger.Printf(format, objects...);
}
};

} // namespace casbin

#endif
#endif
Loading