2013-10-02 21:38:21 +04:00
|
|
|
/**
|
|
|
|
* WinPR: Windows Portable Runtime
|
|
|
|
* WinPR Logger
|
|
|
|
*
|
|
|
|
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/print.h>
|
2014-05-29 23:23:15 +04:00
|
|
|
#include <winpr/sysinfo.h>
|
2014-05-29 23:42:32 +04:00
|
|
|
#include <winpr/environment.h>
|
2013-10-02 21:38:21 +04:00
|
|
|
|
2015-11-09 19:56:44 +03:00
|
|
|
#include "wlog.h"
|
2013-10-02 21:38:21 +04:00
|
|
|
|
|
|
|
#include "wlog/Layout.h"
|
|
|
|
|
2015-02-19 16:47:03 +03:00
|
|
|
#if defined __linux__ && !defined ANDROID
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#endif
|
|
|
|
|
2013-10-02 21:38:21 +04:00
|
|
|
extern const char* WLOG_LEVELS[7];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Log Layout
|
|
|
|
*/
|
|
|
|
|
2017-03-03 15:49:29 +03:00
|
|
|
static void WLog_PrintMessagePrefixVA(wLog* log, wLogMessage* message, const char* format, va_list args)
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
if (!strchr(format, '%'))
|
2017-03-14 12:56:00 +03:00
|
|
|
sprintf_s(message->PrefixString, WLOG_MAX_PREFIX_SIZE - 1, "%s", format);
|
2013-10-02 21:38:21 +04:00
|
|
|
else
|
|
|
|
wvsnprintfx(message->PrefixString, WLOG_MAX_PREFIX_SIZE - 1, format, args);
|
|
|
|
}
|
|
|
|
|
2017-03-03 15:49:29 +03:00
|
|
|
static void WLog_PrintMessagePrefix(wLog* log, wLogMessage* message, const char* format, ...)
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
|
|
WLog_PrintMessagePrefixVA(log, message, format, args);
|
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
2015-10-21 11:11:06 +03:00
|
|
|
BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* message)
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
char* p;
|
|
|
|
int index;
|
|
|
|
int argc = 0;
|
|
|
|
void* args[32];
|
2014-05-28 18:38:32 +04:00
|
|
|
char format[256];
|
|
|
|
SYSTEMTIME localTime;
|
|
|
|
GetLocalTime(&localTime);
|
2013-10-02 21:38:21 +04:00
|
|
|
index = 0;
|
|
|
|
p = (char*) layout->FormatString;
|
|
|
|
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
if (*p == '%')
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
|
|
|
|
if (*p)
|
|
|
|
{
|
2014-05-28 18:38:32 +04:00
|
|
|
if ((p[0] == 'l') && (p[1] == 'v')) /* log level */
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
args[argc++] = (void*) WLOG_LEVELS[message->Level];
|
|
|
|
format[index++] = '%';
|
|
|
|
format[index++] = 's';
|
|
|
|
p++;
|
|
|
|
}
|
2014-05-28 18:38:32 +04:00
|
|
|
else if ((p[0] == 'm') && (p[1] == 'n')) /* module name */
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
args[argc++] = (void*) log->Name;
|
|
|
|
format[index++] = '%';
|
|
|
|
format[index++] = 's';
|
|
|
|
p++;
|
|
|
|
}
|
2014-05-28 18:38:32 +04:00
|
|
|
else if ((p[0] == 'f') && (p[1] == 'l')) /* file */
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
char* file;
|
|
|
|
file = strrchr(message->FileName, '/');
|
|
|
|
|
|
|
|
if (!file)
|
|
|
|
file = strrchr(message->FileName, '\\');
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
file++;
|
|
|
|
else
|
|
|
|
file = (char*) message->FileName;
|
|
|
|
|
|
|
|
args[argc++] = (void*) file;
|
|
|
|
format[index++] = '%';
|
|
|
|
format[index++] = 's';
|
|
|
|
p++;
|
|
|
|
}
|
2014-05-28 18:38:32 +04:00
|
|
|
else if ((p[0] == 'f') && (p[1] == 'n')) /* function */
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
|
|
|
args[argc++] = (void*) message->FunctionName;
|
|
|
|
format[index++] = '%';
|
|
|
|
format[index++] = 's';
|
|
|
|
p++;
|
|
|
|
}
|
2014-05-28 18:38:32 +04:00
|
|
|
else if ((p[0] == 'l') && (p[1] == 'n')) /* line number */
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) message->LineNumber;
|
2013-10-02 21:38:21 +04:00
|
|
|
format[index++] = '%';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2013-10-02 21:38:21 +04:00
|
|
|
p++;
|
|
|
|
}
|
2014-05-28 18:38:32 +04:00
|
|
|
else if ((p[0] == 'p') && (p[1] == 'i') && (p[2] == 'd')) /* process id */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) GetCurrentProcessId();
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p += 2;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 't') && (p[1] == 'i') && (p[2] == 'd')) /* thread id */
|
|
|
|
{
|
2015-02-19 16:47:03 +03:00
|
|
|
#if defined __linux__ && !defined ANDROID
|
|
|
|
/* On Linux we prefer to see the LWP id */
|
2017-02-20 20:31:58 +03:00
|
|
|
args[argc++] = (void*)(size_t) syscall(SYS_gettid);
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'l';
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = 'd';
|
2015-02-19 16:47:03 +03:00
|
|
|
#else
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) GetCurrentThreadId();
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = '%';
|
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '8';
|
|
|
|
format[index++] = 'x';
|
|
|
|
#endif
|
2014-05-28 18:38:32 +04:00
|
|
|
p += 2;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'y') && (p[1] == 'r')) /* year */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wYear;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'm') && (p[1] == 'o')) /* month */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wMonth;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '2';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'd') && (p[1] == 'w')) /* day of week */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wDayOfWeek;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '2';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'd') && (p[1] == 'y')) /* day */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wDay;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '2';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'h') && (p[1] == 'r')) /* hours */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wHour;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '2';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'm') && (p[1] == 'i')) /* minutes */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wMinute;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '2';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 's') && (p[1] == 'e')) /* seconds */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wSecond;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '2';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else if ((p[0] == 'm') && (p[1] == 'l')) /* milliseconds */
|
|
|
|
{
|
2017-02-20 16:28:33 +03:00
|
|
|
args[argc++] = (void*)(size_t) localTime.wMilliseconds;
|
2014-05-28 18:38:32 +04:00
|
|
|
format[index++] = '%';
|
2014-05-29 23:42:32 +04:00
|
|
|
format[index++] = '0';
|
|
|
|
format[index++] = '3';
|
2015-02-19 16:47:03 +03:00
|
|
|
format[index++] = 'u';
|
2014-05-28 18:38:32 +04:00
|
|
|
p++;
|
|
|
|
}
|
2013-10-02 21:38:21 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
format[index++] = *p;
|
|
|
|
}
|
|
|
|
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
format[index++] = '\0';
|
|
|
|
|
|
|
|
switch (argc)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 9:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 11:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9], args[10]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 12:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9], args[10],
|
|
|
|
args[11]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9], args[10],
|
|
|
|
args[11], args[12]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 14:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9], args[10],
|
|
|
|
args[11], args[12], args[13]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 15:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9], args[10],
|
|
|
|
args[11], args[12], args[13], args[14]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
WLog_PrintMessagePrefix(log, message, format, args[0], args[1], args[2], args[3],
|
2017-02-20 16:28:33 +03:00
|
|
|
args[4], args[5], args[6], args[7], args[8], args[9], args[10],
|
|
|
|
args[11], args[12], args[13], args[14], args[15]);
|
2013-10-02 21:38:21 +04:00
|
|
|
break;
|
|
|
|
}
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-10-21 11:11:06 +03:00
|
|
|
return TRUE;
|
2013-10-02 21:38:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
wLogLayout* WLog_GetLogLayout(wLog* log)
|
|
|
|
{
|
|
|
|
wLogAppender* appender;
|
|
|
|
appender = WLog_GetLogAppender(log);
|
|
|
|
return appender->Layout;
|
|
|
|
}
|
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
BOOL WLog_Layout_SetPrefixFormat(wLog* log, wLogLayout* layout, const char* format)
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
2015-05-11 10:07:39 +03:00
|
|
|
free(layout->FormatString);
|
|
|
|
layout->FormatString = NULL;
|
2013-10-02 21:38:21 +04:00
|
|
|
|
2014-05-27 01:54:39 +04:00
|
|
|
if (format)
|
2015-06-17 23:08:02 +03:00
|
|
|
{
|
2014-05-27 01:54:39 +04:00
|
|
|
layout->FormatString = _strdup(format);
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!layout->FormatString)
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
return TRUE;
|
2013-10-02 21:38:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
wLogLayout* WLog_Layout_New(wLog* log)
|
|
|
|
{
|
2017-03-03 14:37:27 +03:00
|
|
|
LPCSTR prefix = "WLOG_PREFIX";
|
2014-05-29 23:42:32 +04:00
|
|
|
DWORD nSize;
|
|
|
|
char* env = NULL;
|
2013-10-02 21:38:21 +04:00
|
|
|
wLogLayout* layout;
|
2014-05-27 01:54:39 +04:00
|
|
|
layout = (wLogLayout*) calloc(1, sizeof(wLogLayout));
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-06-14 01:55:09 +03:00
|
|
|
if (!layout)
|
|
|
|
return NULL;
|
2013-10-02 21:38:21 +04:00
|
|
|
|
2017-03-03 14:37:27 +03:00
|
|
|
nSize = GetEnvironmentVariableA(prefix, NULL, 0);
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-06-14 01:55:09 +03:00
|
|
|
if (nSize)
|
2013-10-02 21:38:21 +04:00
|
|
|
{
|
2015-06-14 01:55:09 +03:00
|
|
|
env = (LPSTR) malloc(nSize);
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-06-14 01:55:09 +03:00
|
|
|
if (!env)
|
2014-05-29 23:42:32 +04:00
|
|
|
{
|
2015-06-14 01:55:09 +03:00
|
|
|
free(layout);
|
|
|
|
return NULL;
|
2014-05-29 23:42:32 +04:00
|
|
|
}
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2017-03-03 14:37:27 +03:00
|
|
|
if (GetEnvironmentVariableA(prefix, env, nSize) != nSize - 1)
|
2017-02-20 16:28:33 +03:00
|
|
|
{
|
|
|
|
free(env);
|
|
|
|
free(layout);
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-06-14 01:55:09 +03:00
|
|
|
}
|
2014-05-29 23:42:32 +04:00
|
|
|
|
2015-06-14 01:55:09 +03:00
|
|
|
if (env)
|
|
|
|
layout->FormatString = env;
|
|
|
|
else
|
|
|
|
{
|
2014-08-07 19:47:59 +04:00
|
|
|
#ifdef ANDROID
|
2015-06-14 01:55:09 +03:00
|
|
|
layout->FormatString = _strdup("[pid=%pid:tid=%tid] - ");
|
2014-08-07 19:47:59 +04:00
|
|
|
#else
|
2015-06-14 01:55:09 +03:00
|
|
|
layout->FormatString = _strdup("[%hr:%mi:%se:%ml] [%pid:%tid] [%lv][%mn] - ");
|
2014-08-07 19:47:59 +04:00
|
|
|
#endif
|
2017-02-20 16:28:33 +03:00
|
|
|
|
2015-06-14 01:55:09 +03:00
|
|
|
if (!layout->FormatString)
|
|
|
|
{
|
|
|
|
free(layout);
|
|
|
|
return NULL;
|
2014-08-07 19:47:59 +04:00
|
|
|
}
|
2013-10-02 21:38:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return layout;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WLog_Layout_Free(wLog* log, wLogLayout* layout)
|
|
|
|
{
|
|
|
|
if (layout)
|
|
|
|
{
|
|
|
|
if (layout->FormatString)
|
2014-05-27 01:54:39 +04:00
|
|
|
{
|
2013-10-02 21:38:21 +04:00
|
|
|
free(layout->FormatString);
|
2014-05-27 01:54:39 +04:00
|
|
|
layout->FormatString = NULL;
|
|
|
|
}
|
2013-10-02 21:38:21 +04:00
|
|
|
|
|
|
|
free(layout);
|
|
|
|
}
|
|
|
|
}
|