Add entry type information at the start of each log file entry.

This commit is contained in:
Robert Knight 2011-08-21 21:47:33 +01:00
parent 2efb4fcaf3
commit 3548f36e8c

View file

@ -31,7 +31,23 @@ void Log::open(const std::string& path)
void Log::write(Type type, const char* text)
{
std::cerr << "log " << text << std::endl;
::write(m_fd,text,strlen(text));
switch (type)
{
case Info:
std::cerr << "INFO ";
break;
case Warn:
std::cerr << "WARN ";
break;
case Error:
std::cerr << "ERROR ";
break;
}
std::cerr << text << std::endl;
if (m_fd >= 0)
{
::write(m_fd,text,strlen(text));
}
}