Skip to content

Commit 68b1137

Browse files
author
Yieen
committed
Log::write string to const reference
1 parent ee121a9 commit 68b1137

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/output/Log.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class Log {
7171
// Writes a message to the log file and if enabled also to the _terminal
7272
// stream
7373
// @exception No custom exceptions
74-
void write(std::string msg, log_level_t level, std::string color = RESET);
74+
void write(std::string const& msg, log_level_t level,
75+
std::string color = RESET);
7576

7677
private:
7778
std::string getLevelColor(log_level_t level);

src/output/Log.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ log_level_t Log::_log_level = LOG_LEVEL;
55
std::string Log::_timeFormat = LOG_TIME_FORMAT;
66
std::string Log::_dateFormat = LOG_DATE_FORMAT;
77

8-
Log::Log(std::ostream& terminal) : _terminal(terminal) {}
8+
Log::Log(std::ostream &terminal) : _terminal(terminal) {}
99

1010
Log::~Log() {}
1111

@@ -50,7 +50,7 @@ log_level_t Log::getLevel() { return _log_level; }
5050

5151
bool Log::getInitialized() { return _initialized; }
5252

53-
void Log::write(std::string msg, log_level_t level, std::string color) {
53+
void Log::write(std::string const &msg, log_level_t level, std::string color) {
5454
if (level > _log_level) return;
5555
std::string timeStamp = "[" + getTime(_dateFormat + " " + _timeFormat) + "] ";
5656
if (_log_to_terminal) {

0 commit comments

Comments
 (0)