diff --git a/casbin/logger.cpp b/casbin/logger.cpp index dd311f0b..b5b56d63 100644 --- a/casbin/logger.cpp +++ b/casbin/logger.cpp @@ -10,13 +10,13 @@ namespace casbin { // Print formats using the default formats for its operands and logs the message. template -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 -void Logger::Printf(std::string format, Object... objects) { +void Logger::Printf(std::string const& format, Object const&... objects) { Print(objects...); } diff --git a/include/casbin/log/Logger.h b/include/casbin/log/Logger.h index bf3be10f..380db885 100644 --- a/include/casbin/log/Logger.h +++ b/include/casbin/log/Logger.h @@ -18,13 +18,13 @@ class Logger { // Print formats using the default formats for its operands and logs the message. template - 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 - void Printf(std::string, Object... objects); + void Printf(std::string const& format, Object const&... objects); }; } // namespace casbin -#endif \ No newline at end of file +#endif diff --git a/include/casbin/log/default_logger.h b/include/casbin/log/default_logger.h index 9e8e90af..ce7b7f57 100644 --- a/include/casbin/log/default_logger.h +++ b/include/casbin/log/default_logger.h @@ -12,14 +12,14 @@ class DefaultLogger : public Logger { bool IsEnabled() { return m_enable; } template - void Print(Object... objects) { + void Print(Object const&... objects) { if (m_enable) { Print(objects...); } } template - void Print(std::string format, Object... objects) { + void Print(std::string const& format, Object const&... objects) { if (m_enable) { Printf(format, objects...); } @@ -28,4 +28,4 @@ class DefaultLogger : public Logger { } // namespace casbin -#endif \ No newline at end of file +#endif diff --git a/include/casbin/log/log_util.h b/include/casbin/log/log_util.h index c9340679..5a709daf 100644 --- a/include/casbin/log/log_util.h +++ b/include/casbin/log/log_util.h @@ -18,17 +18,17 @@ class LogUtil { // LogPrint prints the log. template - static void LogPrint(Object... objects) { + static void LogPrint(Object const&... objects) { s_logger.Print(objects...); } // LogPrintf prints the log with the format. template - 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 \ No newline at end of file +#endif