mirror of
https://github.com/debauchee/barrier.git
synced 2025-06-18 02:31:42 +02:00
* Fixed log output truncating the last byte in each message
* Fixed log output for Release builds (NDEBUG) * Synchronized VS2005/VS2008 preprocessor definitions
This commit is contained in:
parent
419fa0329d
commit
6d0ddb6a6b
10 changed files with 39 additions and 22 deletions
|
@ -149,9 +149,8 @@ CLog::print(const char* file, int line, const char* fmt, ...) const
|
|||
}
|
||||
|
||||
// print the prefix to the buffer. leave space for priority label.
|
||||
char message[2048];
|
||||
if (file != NULL) {
|
||||
|
||||
char message[2048];
|
||||
struct tm *tm;
|
||||
char tmp[220];
|
||||
time_t t;
|
||||
|
@ -169,11 +168,12 @@ CLog::print(const char* file, int line, const char* fmt, ...) const
|
|||
message += pPad - g_priorityPad;
|
||||
}
|
||||
*/
|
||||
// output buffer
|
||||
output(priority, message);
|
||||
} else {
|
||||
output(priority, buffer);
|
||||
}
|
||||
|
||||
// output buffer
|
||||
output(priority, message);
|
||||
|
||||
// clean up
|
||||
if (buffer != stack) {
|
||||
delete[] buffer;
|
||||
|
@ -272,7 +272,10 @@ CLog::output(int priority, char* msg) const
|
|||
*/
|
||||
// find end of message
|
||||
//char* end = msg + g_priorityPad + strlen(msg + g_priorityPad);
|
||||
char* end = msg+strlen(msg)-1;
|
||||
int len = strlen(msg);
|
||||
char* tmp = new char[len+m_maxNewlineLength+1];
|
||||
char* end = tmp + len;
|
||||
strcpy(tmp, msg);
|
||||
|
||||
// write to each outputter
|
||||
CArchMutexLock lock(m_mutex);
|
||||
|
@ -281,13 +284,13 @@ CLog::output(int priority, char* msg) const
|
|||
++index) {
|
||||
// get outputter
|
||||
ILogOutputter* outputter = *index;
|
||||
|
||||
// put an appropriate newline at the end
|
||||
strcpy(end, outputter->getNewline());
|
||||
|
||||
// put an appropriate newline at the end
|
||||
strcpy(end, outputter->getNewline());
|
||||
|
||||
// write message
|
||||
outputter->write(static_cast<ILogOutputter::ELevel>(priority),
|
||||
msg /*+ g_maxPriorityLength - n*/);
|
||||
tmp /*+ g_maxPriorityLength - n*/);
|
||||
}
|
||||
for (COutputterList::const_iterator index = m_outputters.begin();
|
||||
index != m_outputters.end(); ++index) {
|
||||
|
@ -299,8 +302,10 @@ CLog::output(int priority, char* msg) const
|
|||
|
||||
// write message and break out of loop if it returns false
|
||||
if (!outputter->write(static_cast<ILogOutputter::ELevel>(priority),
|
||||
msg /*+ g_maxPriorityLength - n*/)) {
|
||||
tmp /*+ g_maxPriorityLength - n*/)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] tmp;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue