commit 7fe9337d970e46026544445600447753e9a848e4 parent 861a680f80c46aeb80c3c86bb602b7737c9b0bf5 Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Sep 14 15:56:29 +0100 Create the logs directory, Windows compat Diffstat:
log.cc | | | 8 | ++++++++ |
diff --git a/log.cc b/log.cc @@ -4,6 +4,7 @@ #include "intrinsics.h" #include "log.h" +#include "platform_io.h" static bool initialised = false; static FILE * streams[ LOGLEVEL_COUNT + 1 ]; @@ -15,10 +16,17 @@ static const char * names[ LOGLEVEL_COUNT + 1 ] = { "all", }; +// TODO: +#if defined( _WIN32 ) +#define snprintf _snprintf +#endif + // this might lead to trouble with threads static void log_init() { if( initialised ) return; + mkdir( "logs", 0755 ); + for( u32 i = 0; i <= LOGLEVEL_COUNT; i++ ) { char path[ 128 ]; snprintf( path, sizeof( path ), "logs/%llu-%s.log", ( long long unsigned int ) time( NULL ), names[ i ] );