aboutsummaryrefslogtreecommitdiff
path: root/src/filelogger.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2013-05-16 02:23:45 +0200
committerGravatar attilamolnar2013-05-16 02:23:45 +0200
commit712a0e5ff36e5ba052c5d1accf5f5943be4a6e8a (patch)
tree1017bf2e92d1a66507c96abd05ee4063c6c1d647 /src/filelogger.cpp
parentm_joinflood Make the code friendlier, unset +j when the module is unloaded (diff)
Get rid of strlcpy(), strlcat(), charlcat() and charremove()
Diffstat (limited to 'src/filelogger.cpp')
-rw-r--r--src/filelogger.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/filelogger.cpp b/src/filelogger.cpp
index 0575256d0..245cbbaab 100644
--- a/src/filelogger.cpp
+++ b/src/filelogger.cpp
@@ -40,7 +40,7 @@ FileLogStream::~FileLogStream()
void FileLogStream::OnLog(int loglevel, const std::string &type, const std::string &text)
{
- static char TIMESTR[26];
+ static std::string TIMESTR;
static time_t LAST = 0;
if (loglevel < this->loglvl)
@@ -53,11 +53,13 @@ void FileLogStream::OnLog(int loglevel, const std::string &type, const std::stri
time_t local = ServerInstance->Time();
struct tm *timeinfo = localtime(&local);
- strlcpy(TIMESTR,asctime(timeinfo),26);
- TIMESTR[24] = ':';
+ TIMESTR.assign(asctime(timeinfo), 24);
+ TIMESTR += ": ";
LAST = ServerInstance->Time();
}
- std::string out = std::string(TIMESTR) + " " + text.c_str() + "\n";
+ std::string out = TIMESTR;
+ out += text;
+ out += '\n';
this->f->WriteLogLine(out);
}