summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_log.cpp
blob: 06d9a7dbf920217f3a669eef2547b05c298b1d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "stdafx.h"

#include <stdarg.h>
#include <stdio.h>
#include <string.h>


void Log(const char *file, int line, const char *fmt, ...)
{


	va_list vararg;
	const char *file_tmp;
	char str[1024];
	char buf[1024];

	file_tmp = strrchr(file, '\\');
	if (file_tmp == nullptr)
		file_tmp = file;
	else
		file_tmp++;

	va_start(vararg, fmt);
	mir_vsnprintf(str, _countof(str), fmt, vararg);
	va_end(vararg);
	{
		char * tmp = str;
		while (*tmp != '\0')
		{
			if (*tmp == '\n') *tmp = ' ';
			tmp++;
		}
	}
	mir_snprintf(buf, "clist_modern:[%u - %u]: %s \t\t(%s Ln %d)\n", GetCurrentThreadId(), GetTickCount(), str, file_tmp, line);
	Netlib_Log(nullptr, buf);
	OutputDebugStringA(buf);
}