Skip to content

Commit d7785a8

Browse files
committed
Optimize get_logger function
avoid creating a temporary string
1 parent c23d727 commit d7785a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/common/logger/ur_logger.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ namespace logger {
1616

1717
Logger create_logger(std::string logger_name, bool skip_prefix = false);
1818

19-
inline Logger &get_logger(std::string name = "common") {
20-
static Logger logger = create_logger(std::move(name));
19+
inline Logger &get_logger(const char *name = "common") {
20+
static Logger logger = create_logger(name);
2121
return logger;
2222
}
2323

24-
inline void init(std::string name) { get_logger(std::move(name)); }
24+
inline void init(const std::string &name) { get_logger(name.c_str()); }
2525

2626
template <typename... Args>
2727
inline void debug(const char *format, Args &&...args) {

0 commit comments

Comments
 (0)