Logging: Proper fix.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define DEBUG_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
// http://stackoverflow.com/a/2282433
|
||||
#define __func__ __FUNCTION__
|
||||
// http://stackoverflow.com/a/8488201
|
||||
@@ -46,10 +47,13 @@ static void _LOG(_LOG_LEVEL logLevel, char* file, char* func, unsigned int line,
|
||||
if (logLevel > LOG_LEVEL)
|
||||
return;
|
||||
|
||||
char message[2048];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf_s(message, 2048, format, args);
|
||||
char* message = nullptr;
|
||||
size_t size = vsnprintf(message, 0, format, args);
|
||||
message = new char[size+1];
|
||||
message[size] = '\0';
|
||||
vsnprintf(message, size, format, args);
|
||||
va_end(args);
|
||||
|
||||
if (logLevel == LOG_LEVEL_ERROR)
|
||||
@@ -61,6 +65,8 @@ static void _LOG(_LOG_LEVEL logLevel, char* file, char* func, unsigned int line,
|
||||
{
|
||||
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
|
||||
}
|
||||
|
||||
delete[] message;
|
||||
}
|
||||
|
||||
#define LOG(logLevel, format, ...) \
|
||||
|
||||
@@ -43,19 +43,21 @@
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<TargetName>$(SolutionName)-$(Configuration)</TargetName>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
|
||||
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>GLEW_STATIC;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -69,7 +71,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>GLEW_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
||||
Reference in New Issue
Block a user