2
0
Эх сурвалжийг харах

Log directly to ConsoleServer

Daniele Bartolini 11 жил өмнө
parent
commit
a5fd5b6345

+ 0 - 1
engine/Android.mk

@@ -127,7 +127,6 @@ LOCAL_SRC_FILES :=\
 	core/strings/Path.cpp\
 \
 	core/Args.cpp\
-	core/Log.cpp\
 \
 	os/android/Android.cpp\
 	os/android/AndroidDevice.cpp\

+ 0 - 1
engine/CMakeLists.txt

@@ -41,7 +41,6 @@ set (HEADERS
 
 set (CORE_SRC
 	core/Args.cpp
-	core/Log.cpp
 )
 
 set (CORE_HEADERS

+ 35 - 9
engine/ConsoleServer.cpp

@@ -72,26 +72,52 @@ void ConsoleServer::shutdown()
 }
 
 //-----------------------------------------------------------------------------
-void ConsoleServer::log_to_all(const char* message, LogSeverity::Enum severity)
+void ConsoleServer::log_to_all(LogSeverity::Enum severity, const char* message, ...)
 {
-	using namespace string_stream;
-
-	TempAllocator2048 alloc;
-	StringStream json(alloc);
+	va_list args;
+	va_start(args, message);
+	log_to_all(severity, message, args);
+	va_end(args);
+}
 
-	static const char* severity_to_text[] = { "info", "warning", "error", "debug" };
+//-----------------------------------------------------------------------------
+void ConsoleServer::log_to_all(LogSeverity::Enum severity, const char* message, ::va_list arg)
+{
+	using namespace string_stream;
+	static const char* stt[] = { "info", "warning", "error", "debug" };
 
-	json << "{\"type\":\"message\",";
-	json << "\"severity\":\"" << severity_to_text[severity] << "\",";
+	// Log to stdout
+	va_list arg_copy;
+	__va_copy(arg_copy, arg);
 
 	char buf[1024];
-	string::strncpy(buf, message, 1024);
+	int len = vsnprintf(buf, 1024 - 2, message, arg);
+	buf[len] = '\n';
+	buf[len + 1] = '\0';
+
 	for (uint32_t i = 0; i < string::strlen(message); i++)
 	{
 		if (buf[i] == '"')
 			buf[i] = '\'';
 	}
 
+	// Log on local device
+	switch (severity)
+	{
+		case LogSeverity::DEBUG: os::log_debug(message, arg_copy); break;
+		case LogSeverity::WARN: os::log_warning(message, arg_copy); break;
+		case LogSeverity::ERROR: os::log_error(message, arg_copy); break;
+		case LogSeverity::INFO: os::log_info(message, arg_copy); break;
+		default: break;
+	}
+	va_end(arg_copy);
+
+	// Build json message
+	TempAllocator2048 alloc;
+	StringStream json(alloc);
+
+	json << "{\"type\":\"message\",";
+	json << "\"severity\":\"" << stt[severity] << "\",";
 	json << "\"message\":\"" << buf << "\"}";
 
 	send_to_all(c_str(json));

+ 14 - 2
engine/ConsoleServer.h

@@ -30,12 +30,23 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "ContainerTypes.h"
 #include "Queue.h"
 #include "IdArray.h"
-#include "Log.h"
 #include "Config.h"
 
 namespace crown
 {
 
+/// Enumerates log levels.
+struct LogSeverity
+{
+	enum Enum
+	{
+		INFO	= 0,
+		WARN	= 1,
+		ERROR	= 2,
+		DEBUG	= 3
+	};	
+};
+
 struct Client
 {
 	Id id;
@@ -58,7 +69,8 @@ public:
 	void init(uint16_t port, bool wait);
 	void shutdown();
 
-	void log_to_all(const char* message, LogSeverity::Enum severity);
+	void log_to_all(LogSeverity::Enum severity, const char* message, ...);
+	void log_to_all(LogSeverity::Enum severity, const char* message, ::va_list arg);
 
 	/// Collects requests from clients and processes them all.
 	void update();

+ 26 - 42
engine/Device.cpp

@@ -117,15 +117,9 @@ Device::~Device()
 void Device::init()
 {
 	// Initialize
-	Log::i("Initializing Crown Engine %d.%d.%d...", CROWN_VERSION_MAJOR, CROWN_VERSION_MINOR, CROWN_VERSION_MICRO);
+	CE_LOGI("Initializing Crown Engine %d.%d.%d...", CROWN_VERSION_MAJOR, CROWN_VERSION_MINOR, CROWN_VERSION_MICRO);
 
-	// RPC only in debug or development builds
-	#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
-		m_console = CE_NEW(m_allocator, ConsoleServer)();
-		m_console->init(m_console_port, false);
-	#endif
-
-	Log::d("Creating filesystem...");
+	CE_LOGD("Creating filesystem...");
 	// Default bundle filesystem
 	#if defined (LINUX) || defined(WINDOWS)
 		if (m_fileserver == 1)
@@ -150,16 +144,16 @@ void Device::init()
 	m_resource_bundle = Bundle::create(m_allocator, *m_filesystem);
 
 	// Create resource manager
-	Log::d("Creating resource manager...");
+	CE_LOGD("Creating resource manager...");
 	m_resource_manager = CE_NEW(m_allocator, ResourceManager)(*m_resource_bundle, 0);
-	Log::d("Resource seed: %d", m_resource_manager->seed());
+	CE_LOGD("Resource seed: %d", m_resource_manager->seed());
 
 	// Create world manager
-	Log::d("Creating world manager...");
+	CE_LOGD("Creating world manager...");
 	m_world_manager = CE_NEW(m_allocator, WorldManager)();
 
 	// Create window
-	Log::d("Creating main window...");
+	CE_LOGD("Creating main window...");
 	m_window = CE_NEW(m_allocator, OsWindow);
 
 	// Create input devices
@@ -168,22 +162,22 @@ void Device::init()
 	m_touch = CE_NEW(m_allocator, Touch);
 
 	// Create renderer
-	Log::d("Creating renderer...");
+	CE_LOGD("Creating renderer...");
 	m_renderer = CE_NEW(m_allocator, Renderer)(m_allocator);
 	m_renderer->init();
 
-	Log::d("Creating lua system...");
+	CE_LOGD("Creating lua system...");
 	lua_system::init();
 	m_lua_environment = CE_NEW(m_allocator, LuaEnvironment)(lua_system::state());
 
-	Log::d("Creating physics...");
+	CE_LOGD("Creating physics...");
 	physics_system::init();
 
-	Log::d("Creating audio...");
+	CE_LOGD("Creating audio...");
 	audio_system::init();
 
-	Log::d("Crown Engine initialized.");
-	Log::d("Initializing Game...");
+	CE_LOGD("Crown Engine initialized.");
+	CE_LOGD("Initializing Game...");
 
 	m_physics_config = m_resource_manager->load(PHYSICS_CONFIG_EXTENSION, "global");
 	m_resource_manager->flush();
@@ -195,7 +189,7 @@ void Device::init()
 	m_lua_environment->load_and_execute(m_boot_file);
 	m_lua_environment->call_global("init", 0);
 
-	Log::d("Total allocated size: %ld", m_allocator.allocated_size());
+	CE_LOGD("Total allocated size: %ld", m_allocator.allocated_size());
 }
 
 //-----------------------------------------------------------------------------
@@ -208,35 +202,35 @@ void Device::shutdown()
 
 	m_resource_manager->unload(m_physics_config);
 
-	Log::d("Releasing audio...");
+	CE_LOGD("Releasing audio...");
 	audio_system::shutdown();
 
-	Log::d("Releasing physics...");
+	CE_LOGD("Releasing physics...");
 	physics_system::shutdown();
 
-	Log::d("Releasing lua system...");
+	CE_LOGD("Releasing lua system...");
 	lua_system::shutdown();
 	if (m_lua_environment)
 	{
 		CE_DELETE(m_allocator, m_lua_environment);
 	}
 
-	Log::d("Releasing input devices...");
+	CE_LOGD("Releasing input devices...");
 	CE_DELETE(m_allocator, m_touch);
 	CE_DELETE(m_allocator, m_mouse);
 	CE_DELETE(m_allocator, m_keyboard);
 
-	Log::d("Releasing renderer...");
+	CE_LOGD("Releasing renderer...");
 	if (m_renderer)
 	{
 		m_renderer->shutdown();
 		CE_DELETE(m_allocator, m_renderer);
 	}
 
-	Log::d("Releasing world manager...");
+	CE_LOGD("Releasing world manager...");
 	CE_DELETE(m_allocator, m_world_manager);
 
-	Log::d("Releasing resource manager...");
+	CE_LOGD("Releasing resource manager...");
 	if (m_resource_manager)
 	{
 		CE_DELETE(m_allocator, m_resource_manager);
@@ -247,18 +241,12 @@ void Device::shutdown()
 		Bundle::destroy(m_allocator, m_resource_bundle);
 	}
 
-	Log::d("Releasing filesystem...");
+	CE_LOGD("Releasing filesystem...");
 	if (m_filesystem)
 	{
 		CE_DELETE(m_allocator, m_filesystem);
 	}
 
-	#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
-		m_console->shutdown();
-		CE_DELETE(m_allocator, m_console);
-		m_console = NULL;
-	#endif
-
 	m_allocator.clear();
 	m_is_init = false;
 }
@@ -350,14 +338,14 @@ void Device::stop()
 void Device::pause()
 {
 	m_is_paused = true;
-	Log::i("Engine paused.");
+	CE_LOGI("Engine paused.");
 }
 
 //-----------------------------------------------------------------------------
 void Device::unpause()
 {
 	m_is_paused = false;
-	Log::i("Engine unpaused.");
+	CE_LOGI("Engine unpaused.");
 }
 
 //-----------------------------------------------------------------------------
@@ -392,10 +380,6 @@ void Device::frame()
 	m_last_time = m_current_time;
 	m_time_since_start += m_last_delta_time;
 
-	#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
-	m_console->update();
-	#endif
-
 	if (!m_is_paused)
 	{
 		m_resource_manager->poll_resource_loader();
@@ -475,7 +459,7 @@ void Device::reload(const char* type, const char* name)
 
 		if (!m_bundle_compiler->compile(m_bundle_dir, m_source_dir, filename.c_str()))
 		{
-			Log::d("Compilation failed.");
+			CE_LOGD("Compilation failed.");
 			return;
 		}
 
@@ -493,7 +477,7 @@ void Device::reload(const char* type, const char* name)
 		{
 			case UNIT_TYPE:
 			{
-				Log::d("Reloading unit: %s", name);
+				CE_LOGD("Reloading unit: %s", name);
 				/// Reload unit in all worlds
 				for (uint32_t i = 0; i < id_array::size(m_world_manager->worlds()); i++)
 				{
@@ -503,7 +487,7 @@ void Device::reload(const char* type, const char* name)
 			}
 			case SOUND_TYPE:
 			{
-				Log::d("Reloading sound: %s", name);
+				CE_LOGD("Reloading sound: %s", name);
 				for (uint32_t i = 0; i < id_array::size(m_world_manager->worlds()); i++)
 				{
 					m_world_manager->worlds()[i]->sound_world()->reload_sounds((SoundResource*) old_res, (SoundResource*) new_res);

+ 1 - 1
engine/audio/OggDecoder.h

@@ -136,7 +136,7 @@ long int ogg_buffer_tell(void* src)
 //-----------------------------------------------------------------------------
 static const char* ov_error_to_string(int32_t error)
 {
-	Log::i("error: %d", error);
+	CE_LOGI("error: %d", error);
 	switch (error)
 	{
 	case OV_FALSE: return "OV_FALSE";

+ 3 - 3
engine/audio/backend/ALSoundWorld.cpp

@@ -81,9 +81,9 @@ namespace audio_system
 
 		AL_CHECK(alcMakeContextCurrent(s_al_context));
 
-		Log::d("OpenAL Vendor   : %s", alGetString(AL_VENDOR));
-		Log::d("OpenAL Version  : %s", alGetString(AL_VERSION));
-		Log::d("OpenAL Renderer : %s", alGetString(AL_RENDERER));
+		CE_LOGD("OpenAL Vendor   : %s", alGetString(AL_VENDOR));
+		CE_LOGD("OpenAL Version  : %s", alGetString(AL_VERSION));
+		CE_LOGD("OpenAL Renderer : %s", alGetString(AL_RENDERER));
 
 		AL_CHECK(alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED));
 		AL_CHECK(alDopplerFactor(1.0f));

+ 3 - 3
engine/compilers/BundleCompiler.cpp

@@ -88,7 +88,7 @@ bool BundleCompiler::compile(const char* bundle_dir, const char* source_dir, con
 		}
 		else
 		{
-			Log::d("'crown.config' does not exist.");
+			CE_LOGD("'crown.config' does not exist.");
 			return false;
 		}
 	}
@@ -119,7 +119,7 @@ bool BundleCompiler::compile(const char* bundle_dir, const char* source_dir, con
 			continue;
 		}
 
-		Log::i("%s <= %s", out_name, filename);
+		CE_LOGI("%s <= %s", out_name, filename);
 
 		DiskFilesystem root_fs(source_dir);
 		DiskFilesystem dest_fs(bundle_dir);
@@ -183,7 +183,7 @@ bool BundleCompiler::compile(const char* bundle_dir, const char* source_dir, con
 			}
 			else
 			{
-				Log::e("Oops, unknown resource type!");
+				CE_LOGE("Oops, unknown resource type!");
 				return false;
 			}
 

+ 3 - 3
engine/core/Args.cpp

@@ -141,7 +141,7 @@ int32_t Args::long_option(const char* option)
 				}
 				else
 				{
-					Log::e("%s: option requires an argument -- '%s'", m_argv[0], current_option->name);
+					// CE_LOGE("%s: option requires an argument -- '%s'", m_argv[0], current_option->name);
 
 					// Missing option
 					m_optind += 1;
@@ -170,7 +170,7 @@ int32_t Args::long_option(const char* option)
 	}
 
 	// Found a long option but was not included in longopts
-	Log::e("%s: invalid option -- '%s'", m_argv[0], &option[2]);
+	// CE_LOGE("%s: invalid option -- '%s'", m_argv[0], &option[2]);
 	m_optind++;
 	return '?';
 }
@@ -180,7 +180,7 @@ int32_t Args::short_option(const char* option)
 {
 	(void)option;
 
-	Log::e("%s: invalid option -- '%s'", m_argv[0], &option[1]);
+	// CE_LOGE("%s: invalid option -- '%s'", m_argv[0], &option[1]);
 	m_optind++;
 	return '?';
 }

+ 11 - 11
engine/core/Error.h

@@ -24,7 +24,11 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Log.h"
+#pragma once
+
+#include "Config.h"
+#include "Types.h"
+#include "Macros.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -34,10 +38,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 	#include <execinfo.h>
 #endif
 
-#include "Config.h"
-
-#pragma once
-
 namespace crown
 {
 namespace error
@@ -84,13 +84,13 @@ inline void log_backtrace()
 			int status;
 			char* real_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
 
-			Log::e("\t[%d] %s: (%s)+%s %s", i, messages[i], (status == 0 ? real_name : mangled_name), offset_begin, offset_end);
+			printf("\t[%d] %s: (%s)+%s %s\n", i, messages[i], (status == 0 ? real_name : mangled_name), offset_begin, offset_end);
 			free(real_name);
 		}
 		// otherwise, print the whole line
 		else
 		{
-			Log::e("\t[%d] %s", i, messages[i]);
+			printf("\t[%d] %s\n", i, messages[i]);
 		}
 	}
 	free(messages);
@@ -103,14 +103,14 @@ inline void abort(const char* file, int line, const char* message, ...)
 {
 	va_list ap;
 	va_start(ap, message);
-	Log::e1(message, ap);
+	vprintf(message, ap);
 	va_end(ap);
-	Log::e("\tIn: %s:%d\n", file, line);
-	Log::e("Backtrace:");
+	printf("\tIn: %s:%d\n", file, line);
+	printf("Backtrace:\n");
 	//fflush(0);
 	log_backtrace();
 	exit(EXIT_FAILURE);
 }
 
 } // namespace error
-} // namespace crown
+} // namespace crown

+ 0 - 154
engine/core/Log.cpp

@@ -1,154 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include "Log.h"
-#include "Device.h"
-#include "ConsoleServer.h"
-
-namespace crown
-{
-
-LogSeverity::Enum Log::m_threshold = LogSeverity::DEBUG;
-
-//-----------------------------------------------------------------------------
-LogSeverity::Enum Log::threshold()
-{
-	return m_threshold;
-}
-
-//-----------------------------------------------------------------------------
-void Log::set_threshold(LogSeverity::Enum threshold)
-{
-	m_threshold = threshold;
-}
-
-//-----------------------------------------------------------------------------
-void Log::log_message(LogSeverity::Enum severity, const char* message, ::va_list arg)
-{
-	if (severity > m_threshold)
-	{
-		return;
-	}
-
-	va_list arg_copy;
-	__va_copy(arg_copy, arg);
-
-	char buf[1024];
-	int len = vsnprintf(buf, 1024 - 2, message, arg);
-	buf[len] = '\n';
-	buf[len + 1] = '\0';
-
-	// Log on local device
-	switch (severity)
-	{
-		case LogSeverity::DEBUG: os::log_debug(message, arg_copy); break;
-		case LogSeverity::WARN: os::log_warning(message, arg_copy); break;
-		case LogSeverity::ERROR: os::log_error(message, arg_copy); break;
-		case LogSeverity::INFO: os::log_info(message, arg_copy); break;
-		default: break;
-	}
-	va_end(arg_copy);
-
-	// // Log to remote clients
-	// if (device()->console() != NULL && string::strlen(buf) > 0)
-	// {
-	// 	device()->console()->log_to_all(buf, severity);
-	// }
-}
-
-//-----------------------------------------------------------------------------
-void Log::d(const char* message, ...)
-{
-	va_list args;
-	va_start (args, message);
-	Log::d1(message, args);
-	va_end (args);
-}
-
-//-----------------------------------------------------------------------------
-void Log::e(const char* message, ...)
-{
-	va_list args;
-	va_start (args, message);
-	Log::e1(message, args);
-	va_end (args);
-}
-
-//-----------------------------------------------------------------------------
-void Log::w(const char* message, ...)
-{
-	va_list args;
-	va_start (args, message);
-	Log::w1(message, args);
-	va_end (args);
-}
-
-//-----------------------------------------------------------------------------
-void Log::i(const char* message, ...)
-{
-	va_list args;
-	va_start (args, message);
-	Log::i1(message, args);
-	va_end (args);
-}
-
-//-----------------------------------------------------------------------------
-void Log::d1(const char* message, ::va_list args)
-{
-	va_list arg_copy;
-	__va_copy(arg_copy, args);
-	log_message(LogSeverity::DEBUG, message, arg_copy);
-	va_end(arg_copy);
-}
-
-//-----------------------------------------------------------------------------
-void Log::e1(const char* message, ::va_list args)
-{
-	va_list arg_copy;
-	__va_copy(arg_copy, args);
-	log_message(LogSeverity::ERROR, message, arg_copy);
-	va_end(arg_copy);
-}
-
-//-----------------------------------------------------------------------------
-void Log::w1(const char* message, ::va_list args)
-{
-	va_list arg_copy;
-	__va_copy(arg_copy, args);
-	log_message(LogSeverity::WARN, message, arg_copy);
-	va_end(arg_copy);
-}
-
-//-----------------------------------------------------------------------------
-void Log::i1(const char* message, ::va_list args)
-{
-	va_list arg_copy;
-	__va_copy(arg_copy, args);
-	log_message(LogSeverity::INFO, message, arg_copy);
-	va_end(arg_copy);
-}
-
-} // namespace crown

+ 14 - 53
engine/core/Log.h

@@ -26,56 +26,17 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include <cstdio>
-#include <cstdarg>
-#include "Types.h"
-#include "Macros.h"
-
-namespace crown
-{
-
-/// Enumerates log levels.
-struct LogSeverity
-{
-	enum Enum
-	{
-		INFO	= 0,
-		WARN	= 1,
-		ERROR	= 2,
-		DEBUG	= 3
-	};	
-};
-
-class RPCServer;
-
-/// Used to log messages.
-class CE_EXPORT Log
-{
-
-public:
-
-	/// Returns the threshold used to filter out log messages.
-	static LogSeverity::Enum threshold();
-
-	/// Sets the thresold used to filter out log messages
-	static void			set_threshold(LogSeverity::Enum threshold);
-
-	static void			log_message(LogSeverity::Enum severity, const char* message, ::va_list arg);
-
-	static void			d(const char* message, ...);
-	static void			e(const char* message, ...);
-	static void			w(const char* message, ...);
-	static void			i(const char* message, ...);
-	static void			d1(const char* message, ::va_list args);
-	static void			e1(const char* message, ::va_list args);
-	static void			w1(const char* message, ::va_list args);
-	static void			i1(const char* message, ::va_list args);
-
-private:
-
-
-	static LogSeverity::Enum m_threshold;
-};
-
-} // namespace crown
-
+#include "Device.h"
+#include "ConsoleServer.h"
+
+#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+	#define CE_LOGI(msg, ...) crown::device()->console()->log_to_all(LogSeverity::INFO, msg, ##__VA_ARGS__)
+	#define CE_LOGD(msg, ...) crown::device()->console()->log_to_all(LogSeverity::DEBUG, msg, ##__VA_ARGS__)
+	#define CE_LOGE(msg, ...) crown::device()->console()->log_to_all(LogSeverity::ERROR, msg, ##__VA_ARGS__)
+	#define CE_LOGW(msg, ...) crown::device()->console()->log_to_all(LogSeverity::WARN, msg, ##__VA_ARGS__)
+#else
+	#define CE_LOGI(msg, ...) ((void)0)
+	#define CE_LOGD(msg, ...) ((void)0)
+	#define CE_LOGE(msg, ...) ((void)0)
+	#define CE_LOGW(msg, ...) ((void)0)
+#endif

+ 1 - 1
engine/core/Profiler.h

@@ -96,7 +96,7 @@ namespace profiler
 		// 	char* p = t_buffer + cur;
 		// 	uint32_t event_type = *(uint32_t*) p;
 		// 	RecordFloat event = *(RecordFloat*)(p + sizeof(uint32_t));
-		// 	Log::d("ev type = %d, name = %s, value = %f\n", event_type, event.name, 1.0 / event.value);
+		// 	CE_LOGD("ev type = %d, name = %s, value = %f\n", event_type, event.name, 1.0 / event.value);
 		// 	cur += sizeof(uint32_t) + sizeof(RecordFloat);
 		// }
 	}

+ 1 - 1
engine/lua/LuaSystem.cpp

@@ -110,7 +110,7 @@ namespace lua_system
 		lua_pushinteger(L, 2);
 		lua_call(L, 2, 1); // Call debug.traceback
 
-		Log::e(lua_tostring(L, -1)); // Print error message
+		CE_LOGE(lua_tostring(L, -1)); // Print error message
 		lua_pop(L, 1); // Remove error message from stack
 		lua_pop(L, 1); // Remove debug.traceback from stack
 

+ 15 - 7
engine/os/android/AndroidDevice.cpp

@@ -61,16 +61,31 @@ public:
 	//-----------------------------------------------------------------------------
 	int32_t loop()
 	{
+		#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+			m_console = CE_NEW(default_allocator(), ConsoleServer)();
+			m_console->init(m_console_port, false);
+		#endif
+
 		Device::init();
 
 		while (is_running() && !process_events())
 		{
+			#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+				m_console->update();
+			#endif
+
 			Device::frame();
 			m_touch->update();
 			m_keyboard->update();
 		}
 
 		Device::shutdown();
+
+		#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+			m_console->shutdown();
+			CE_DELETE(default_allocator(), m_console);
+		#endif
+
 		exit(0);
 		return 0; // Just to not get a warning
 	}
@@ -108,7 +123,6 @@ public:
 				{
 					const OsKeyboardEvent& ev = event.keyboard;
 					m_keyboard->set_button_state(ev.button, ev.pressed);
-					Log::i("KEYBOARD EVENT RECEIVED");
 					break;
 				}
 				case OsEvent::METRICS:
@@ -118,23 +132,19 @@ public:
 					m_window->m_y = 0;
 					m_window->m_width = ev.width;
 					m_window->m_height = ev.height;
-					Log::i("METRICS EVENT RECEIVED");
 					break;
 				}
 				case OsEvent::EXIT:
 				{
-					Log::i("EXIT EVENT RECEIVED");
 					return true;
 				}
 				case OsEvent::PAUSE:
 				{
-					Log::i("PAUSE EVENT RECEIVED, pausing...");
 					pause();
 					break;
 				}
 				case OsEvent::RESUME:
 				{
-					Log::i("RESUME EVENT RECEIVED, resuming...");
 					unpause();
 					break;
 				}
@@ -229,14 +239,12 @@ extern "C" void Java_crown_android_CrownLib_acquireWindow(JNIEnv *env, jclass /*
 	CE_ASSERT(surface != 0, "Unable to get Android window");
     g_android_window = ANativeWindow_fromSurface(env, surface);
     ANativeWindow_acquire(g_android_window);
-    Log::i("Window acquired");
 }
 
 //-----------------------------------------------------------------------------
 extern "C" void Java_crown_android_CrownLib_releaseWindow(JNIEnv *env, jclass /*clazz*/, jobject surface)
 {
     ANativeWindow_release(g_android_window);
-    Log::i("Window released");
 }
 
 //-----------------------------------------------------------------------------

+ 31 - 17
engine/os/linux/main.cpp

@@ -137,6 +137,7 @@ public:
 		, m_fullscreen(0)
 		, m_compile(0)
 		, m_continue(0)
+		, m_wait_console(0)
 	{
 	}
 
@@ -147,13 +148,16 @@ public:
 		check_preferred_settings();
 
 		#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+			m_console = CE_NEW(default_allocator(), ConsoleServer)();
+			m_console->init(m_console_port, (bool) m_wait_console);
+
 			if (m_compile == 1)
 			{
 				m_bundle_compiler = CE_NEW(default_allocator(), BundleCompiler);
 				if (!m_bundle_compiler->compile(m_bundle_dir, m_source_dir))
 				{
 					CE_DELETE(default_allocator(), m_bundle_compiler);
-					Log::e("Exiting.");
+					CE_LOGE("Exiting.");
 					exit(EXIT_FAILURE);
 				}
 
@@ -176,6 +180,9 @@ public:
 	{
 		#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
 			CE_DELETE(default_allocator(), m_bundle_compiler);
+
+			m_console->shutdown();
+			CE_DELETE(default_allocator(), m_console);
 		#endif
 	}
 
@@ -273,6 +280,10 @@ public:
 
 		while(!process_events() && is_running())
 		{
+			#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+				m_console->update();
+			#endif
+
 			Device::frame();
 
 			m_keyboard->update();
@@ -483,21 +494,23 @@ public:
 			"  --compile                  Do a full compile of the resources.\n"
 			"  --continue                 Continue the execution after the resource compilation step.\n"
 			"  --file-server              Read resources from a remote engine instance.\n"
-			"  --console-port             Set the network port of the console server.\n";
+			"  --console-port             Set the network port of the console server.\n"
+			"  --wait-console             Wait for a console connection before starting up.\n";
 
 		static ArgsOption options[] = 
 		{
-			{ "help",             AOA_NO_ARGUMENT,       NULL,        'i' },
-			{ "source-dir",       AOA_REQUIRED_ARGUMENT, NULL,        's' },
-			{ "bundle-dir",       AOA_REQUIRED_ARGUMENT, NULL,        'b' },
-			{ "compile",          AOA_NO_ARGUMENT,       &m_compile,   1 },
-			{ "continue",         AOA_NO_ARGUMENT,       &m_continue,  1 },
-			{ "width",            AOA_REQUIRED_ARGUMENT, NULL,        'w' },
-			{ "height",           AOA_REQUIRED_ARGUMENT, NULL,        'h' },
-			{ "fullscreen",       AOA_NO_ARGUMENT,       &m_fullscreen, 1 },
-			{ "parent-window",    AOA_REQUIRED_ARGUMENT, NULL,        'p' },
-			{ "file-server",      AOA_NO_ARGUMENT,       &m_fileserver, 1 },
-			{ "console-port",     AOA_REQUIRED_ARGUMENT, NULL,        'c' },
+			{ "help",             AOA_NO_ARGUMENT,       NULL,           'i' },
+			{ "source-dir",       AOA_REQUIRED_ARGUMENT, NULL,           's' },
+			{ "bundle-dir",       AOA_REQUIRED_ARGUMENT, NULL,           'b' },
+			{ "compile",          AOA_NO_ARGUMENT,       &m_compile,       1 },
+			{ "continue",         AOA_NO_ARGUMENT,       &m_continue,      1 },
+			{ "width",            AOA_REQUIRED_ARGUMENT, NULL,           'w' },
+			{ "height",           AOA_REQUIRED_ARGUMENT, NULL,           'h' },
+			{ "fullscreen",       AOA_NO_ARGUMENT,       &m_fullscreen,    1 },
+			{ "parent-window",    AOA_REQUIRED_ARGUMENT, NULL,           'p' },
+			{ "file-server",      AOA_NO_ARGUMENT,       &m_fileserver,    1 },
+			{ "console-port",     AOA_REQUIRED_ARGUMENT, NULL,           'c' },
+			{ "wait-console",     AOA_NO_ARGUMENT,       &m_wait_console,  1 },
 			{ NULL, 0, NULL, 0 }
 		};
 
@@ -566,26 +579,26 @@ public:
 		{
 			if (string::strcmp(m_source_dir, "") == 0)
 			{
-				Log::e("You have to specify the source directory when running in compile mode.");
+				CE_LOGE("You have to specify the source directory when running in compile mode.");
 				exit(EXIT_FAILURE);
 			}
 
 			if (!os::is_absolute_path(m_source_dir))
 			{
-				Log::e("The source directory must be absolute.");
+				CE_LOGE("The source directory must be absolute.");
 				exit(EXIT_FAILURE);
 			}
 		}
 
 		if (!os::is_absolute_path(m_bundle_dir))
 		{
-			Log::e("The bundle directory must be absolute.");
+			CE_LOGE("The bundle directory must be absolute.");
 			exit(EXIT_FAILURE);
 		}
 
 		if (m_width == 0 || m_height == 0)
 		{
-			Log::e("Window width and height must be greater than zero.");
+			CE_LOGE("Window width and height must be greater than zero.");
 			exit(EXIT_FAILURE);
 		}
 	}
@@ -650,6 +663,7 @@ private:
 	int32_t m_fullscreen;
 	int32_t m_compile;
 	int32_t m_continue;
+	int32_t m_wait_console;
 
 	OsEventQueue m_queue;
 };

+ 31 - 17
engine/os/win/main.cpp

@@ -138,6 +138,7 @@ public:
 		, m_mouse_lock(false)
 		, m_started(false)
 		, m_exit(false)
+		, m_wait_console(0)
 	{
 
 	}
@@ -149,13 +150,16 @@ public:
 		check_preferred_settings();
 
 		#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+			m_console = CE_NEW(default_allocator(), ConsoleServer)();
+			m_console->init(m_console_port, (bool) m_wait_console);
+
 			if (m_compile == 1)
 			{
 				m_bundle_compiler = CE_NEW(default_allocator(), BundleCompiler);
 				if (!m_bundle_compiler->compile(m_bundle_dir, m_source_dir))
 				{
 					CE_DELETE(default_allocator(), m_bundle_compiler);
-					Log::e("Exiting.");
+					CE_LOGE("Exiting.");
 					exit(EXIT_FAILURE);
 				}
 
@@ -175,6 +179,9 @@ public:
 	{
 		#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
 			CE_DELETE(default_allocator(), m_bundle_compiler);
+
+			m_console->shutdown();
+			CE_DELETE(default_allocator(), m_console);
 		#endif
 	}
 
@@ -288,6 +295,10 @@ public:
 
 		while(!process_events() && is_running())
 		{
+			#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
+				m_console->update();
+			#endif
+
 			Device::frame();
 
 			m_keyboard->update();
@@ -709,20 +720,22 @@ public:
 			"  --continue                 Continue the execution after the resource compilation step.\n"
 			"  --file-server              Read resources from a remote engine instance.\n"
 			"  --console-port             Set the network port of the console server.\n";
+			"  --wait-console             Wait for a console connection before starting up.\n";
 
 		static ArgsOption options[] = 
 		{
-			{ "help",             AOA_NO_ARGUMENT,       NULL,        'i' },
-			{ "source-dir",       AOA_REQUIRED_ARGUMENT, NULL,        's' },
-			{ "bundle-dir",       AOA_REQUIRED_ARGUMENT, NULL,        'b' },
-			{ "compile",          AOA_NO_ARGUMENT,       &m_compile,   1 },
-			{ "continue",         AOA_NO_ARGUMENT,       &m_continue,  1 },
-			{ "width",            AOA_REQUIRED_ARGUMENT, NULL,        'w' },
-			{ "height",           AOA_REQUIRED_ARGUMENT, NULL,        'h' },
-			{ "fullscreen",       AOA_NO_ARGUMENT,       &m_fullscreen, 1 },
-			{ "parent-window",    AOA_REQUIRED_ARGUMENT, NULL,        'p' },
-			{ "file-server",      AOA_NO_ARGUMENT,       &m_fileserver, 1 },
-			{ "console-port",     AOA_REQUIRED_ARGUMENT, NULL,        'c' },
+			{ "help",             AOA_NO_ARGUMENT,       NULL,           'i' },
+			{ "source-dir",       AOA_REQUIRED_ARGUMENT, NULL,           's' },
+			{ "bundle-dir",       AOA_REQUIRED_ARGUMENT, NULL,           'b' },
+			{ "compile",          AOA_NO_ARGUMENT,       &m_compile,       1 },
+			{ "continue",         AOA_NO_ARGUMENT,       &m_continue,      1 },
+			{ "width",            AOA_REQUIRED_ARGUMENT, NULL,           'w' },
+			{ "height",           AOA_REQUIRED_ARGUMENT, NULL,           'h' },
+			{ "fullscreen",       AOA_NO_ARGUMENT,       &m_fullscreen,    1 },
+			{ "parent-window",    AOA_REQUIRED_ARGUMENT, NULL,           'p' },
+			{ "file-server",      AOA_NO_ARGUMENT,       &m_fileserver,    1 },
+			{ "console-port",     AOA_REQUIRED_ARGUMENT, NULL,           'c' },
+			{ "wait-console",     AOA_NO_ARGUMENT,       &m_wait_console,  1 },
 			{ NULL, 0, NULL, 0 }
 		};
 
@@ -791,26 +804,26 @@ public:
 		{
 			if (string::strcmp(m_source_dir, "") == 0)
 			{
-				Log::e("You have to specify the source directory when running in compile mode.");
+				CE_LOGE("You have to specify the source directory when running in compile mode.");
 				exit(EXIT_FAILURE);
 			}
 
 			if (!os::is_absolute_path(m_source_dir))
 			{
-				Log::e("The source directory must be absolute.");
+				CE_LOGE("The source directory must be absolute.");
 				exit(EXIT_FAILURE);
 			}
 		}
 
 		if (!os::is_absolute_path(m_bundle_dir))
 		{
-			Log::e("The bundle directory must be absolute.");
+			CE_LOGE("The bundle directory must be absolute.");
 			exit(EXIT_FAILURE);
 		}
 
 		// if (m_width == 0 || m_height == 0)
 		// {
-		// 	Log::e("Window width and height must be greater than zero.");
+		// 	CE_LOGE("Window width and height must be greater than zero.");
 		// 	exit(EXIT_FAILURE);
 		// }
 	}
@@ -883,7 +896,8 @@ public:
 	uint32_t m_parent_window_handle;
 	int32_t m_fullscreen;
 	int32_t m_compile;
-	int32_t m_continue;	
+	int32_t m_continue;
+	int32_t m_wait_console;
 
 	OsEventQueue m_queue;
 };

+ 2 - 2
engine/physics/PhysicsWorld.cpp

@@ -128,13 +128,13 @@ namespace physics_system
 			{
 				case PxErrorCode::eDEBUG_INFO:
 				{
-					Log::i("PhysX: %s", message);
+					CE_LOGI("PhysX: %s", message);
 					break;
 				}
 				case PxErrorCode::eDEBUG_WARNING: 
 				case PxErrorCode::ePERF_WARNING:
 				{
-					Log::w("PhysX: %s", message);
+					CE_LOGW("PhysX: %s", message);
 					break;
 				}
 				case PxErrorCode::eINVALID_PARAMETER:

+ 17 - 17
engine/renderers/backend/gl/GLRenderer.cpp

@@ -499,8 +499,8 @@ struct GPUProgram
 		GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_ATTRIBUTES, &num_active_attribs));
 		GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_UNIFORMS, &num_active_uniforms));
 
-		// Log::d("Found %d active attribs", num_active_attribs);
-		// Log::d("Found %d active uniforms", num_active_uniforms);
+		// CE_LOGD("Found %d active attribs", num_active_attribs);
+		// CE_LOGD("Found %d active uniforms", num_active_uniforms);
 
 		// Find active attribs/uniforms max length
 		GLint max_attrib_length;
@@ -516,7 +516,7 @@ struct GPUProgram
 			GL_CHECK(glGetActiveAttrib(m_id, attrib, max_attrib_length, NULL, &attrib_size, &attrib_type, attrib_name));
 
 			/* GLint attrib_location = */GL_CHECK(glGetAttribLocation(m_id, attrib_name));
-			// Log::d("Attrib %d: name = '%s' location = '%d'", attrib, attrib_name, attrib_location);
+			// CE_LOGD("Attrib %d: name = '%s' location = '%d'", attrib, attrib_name, attrib_location);
 		}
 
 		m_num_active_attribs = 0;
@@ -561,7 +561,7 @@ struct GPUProgram
 				m_num_uniforms++;
 			}
 
-			// Log::d("Uniform %d: name = '%s' location = '%d' stock = %s", uniform, uniform_name, uniform_location,
+			// CE_LOGD("Uniform %d: name = '%s' location = '%d' stock = %s", uniform, uniform_name, uniform_location,
 			// 			 (stock_uniform != ShaderUniform::COUNT) ? "yes" : "no");
 		}
 	}
@@ -767,19 +767,19 @@ public:
 		GL_CHECK(glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, &m_min_max_point_size[0]));
 		// GL_CHECK(glGetFloatv(GL_LINE_WIDTH_RANGE, &m_min_max_line_width[0]));
 
-		Log::i("OpenGL Vendor        : %s", glGetString(GL_VENDOR));
-		Log::i("OpenGL Renderer      : %s", glGetString(GL_RENDERER));
-		Log::i("OpenGL Version       : %s", glGetString(GL_VERSION));
-		Log::i("GLSL Version         : %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
+		CE_LOGI("OpenGL Vendor        : %s", glGetString(GL_VENDOR));
+		CE_LOGI("OpenGL Renderer      : %s", glGetString(GL_RENDERER));
+		CE_LOGI("OpenGL Version       : %s", glGetString(GL_VERSION));
+		CE_LOGI("GLSL Version         : %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
 
-		Log::d("Min Point Size       : %f", m_min_max_point_size[0]);
-		Log::d("Max Point Size       : %f", m_min_max_point_size[1]);
-		Log::d("Min Line Width       : %f", m_min_max_line_width[0]);
-		Log::d("Max Line Width       : %f", m_min_max_line_width[1]);
-		Log::d("Max Texture Size     : %dx%d", m_max_texture_size, m_max_texture_size);
-		Log::d("Max Texture Units    : %d", m_max_texture_units);
-		Log::d("Max Vertex Indices   : %d", m_max_vertex_indices);
-		Log::d("Max Vertex Vertices  : %d", m_max_vertex_vertices);
+		CE_LOGD("Min Point Size       : %f", m_min_max_point_size[0]);
+		CE_LOGD("Max Point Size       : %f", m_min_max_point_size[1]);
+		CE_LOGD("Min Line Width       : %f", m_min_max_line_width[0]);
+		CE_LOGD("Max Line Width       : %f", m_min_max_line_width[1]);
+		CE_LOGD("Max Texture Size     : %dx%d", m_max_texture_size, m_max_texture_size);
+		CE_LOGD("Max Texture Units    : %d", m_max_texture_units);
+		CE_LOGD("Max Vertex Indices   : %d", m_max_vertex_indices);
+		CE_LOGD("Max Vertex Vertices  : %d", m_max_vertex_vertices);
 
 		#if defined(LINUX) || defined(WINDOWS)
 			// Point sprites enabled by default
@@ -787,7 +787,7 @@ public:
 			GL_CHECK(glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE));
 		#endif
 
-		Log::i("OpenGL Renderer initialized.");
+		CE_LOGI("OpenGL Renderer initialized.");
 	}
 
 	//-----------------------------------------------------------------------------

+ 3 - 3
engine/renderers/backend/gl/egl/GLContext.cpp

@@ -96,7 +96,7 @@ void GLContext::create_context()
 	EGLBoolean init_success = EGL_CHECK(eglInitialize(display, &egl_major, &egl_minor));
 	CE_ASSERT(init_success == EGL_TRUE, "Failed to initialize EGL");
 
-	Log::d("EGL Initialized: major = %d, minor = %d", egl_major, egl_minor);
+	CE_LOGD("EGL Initialized: major = %d, minor = %d", egl_major, egl_minor);
 
 	EGLBoolean bind_success = EGL_CHECK(eglBindAPI(EGL_OPENGL_ES_API));
 	CE_ASSERT(bind_success != EGL_FALSE, "Failed to bind OpenGL|ES API");
@@ -117,7 +117,7 @@ void GLContext::create_context()
 
 	EGL_CHECK(eglMakeCurrent(display, surface, surface, context));
 
-	Log::d("EGL context created");
+	CE_LOGD("EGL context created");
 }
 
 //-----------------------------------------------------------------------------
@@ -129,7 +129,7 @@ void GLContext::destroy_context()
 	EGL_CHECK(eglTerminate(display));
     display = EGL_NO_DISPLAY;
 
-	Log::i("EGL context destroyed");
+	CE_LOGI("EGL context destroyed");
 }
 
 //-----------------------------------------------------------------------------

+ 1 - 1
engine/resource/LuaResource.cpp

@@ -84,7 +84,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	}
 	else
 	{
-		Log::e("Error while reading luajit bytecode");
+		CE_LOGE("Error while reading luajit bytecode");
 		return;
 	}
 

+ 2 - 2
engine/resource/MeshResource.cpp

@@ -78,7 +78,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 	if (position.is_nil())
 	{
-		Log::e("Bad mesh: array 'position' not found.");
+		CE_LOGE("Bad mesh: array 'position' not found.");
 		return;
 	}
 	Array<float> position_array(default_allocator());
@@ -103,7 +103,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	JSONElement index = root.key_or_nil("index");
 	if (index.is_nil())
 	{
-		Log::e("Bad mesh: array 'index' not found.");
+		CE_LOGE("Bad mesh: array 'index' not found.");
 		return;
 	}
 

+ 11 - 11
engine/resource/PackageResource.cpp

@@ -75,7 +75,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(texture_name.c_str()))
 			{
-				Log::e("Texture '%s' does not exist.", texture_name.c_str());
+				CE_LOGE("Texture '%s' does not exist.", texture_name.c_str());
 				return;
 			}
 
@@ -99,7 +99,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(lua_name.c_str()))
 			{
-				Log::e("Lua script '%s' does not exist.", lua_name.c_str());
+				CE_LOGE("Lua script '%s' does not exist.", lua_name.c_str());
 				return;
 			}
 
@@ -122,7 +122,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(sound_name.c_str()))
 			{
-				Log::e("Sound '%s' does not exist.", sound_name.c_str());
+				CE_LOGE("Sound '%s' does not exist.", sound_name.c_str());
 				return;
 			}
 
@@ -145,7 +145,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(mesh_name.c_str()))
 			{
-				Log::e("Mesh '%s' does not exist.", mesh_name.c_str());
+				CE_LOGE("Mesh '%s' does not exist.", mesh_name.c_str());
 				return;
 			}
 
@@ -168,7 +168,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(unit_name.c_str()))
 			{
-				Log::e("Unit '%s' does not exist.", unit_name.c_str());
+				CE_LOGE("Unit '%s' does not exist.", unit_name.c_str());
 			}
 
 			ResourceId id;
@@ -190,7 +190,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(sprite_name.c_str()))
 			{
-				Log::e("Sprite '%s' does not exist.", sprite_name.c_str());
+				CE_LOGE("Sprite '%s' does not exist.", sprite_name.c_str());
 				return;
 			}
 
@@ -213,7 +213,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(physics_name.c_str()))
 			{
-				Log::e("Physics '%s' does not exist.", physics_name.c_str());
+				CE_LOGE("Physics '%s' does not exist.", physics_name.c_str());
 				return;
 			}
 
@@ -236,7 +236,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(materials_name.c_str()))
 			{
-				Log::e("Material '%s' does not exist.", materials_name.c_str());
+				CE_LOGE("Material '%s' does not exist.", materials_name.c_str());
 				return;
 			}
 
@@ -259,7 +259,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(guis_name.c_str()))
 			{
-				Log::e("gui '%s' does not exist.", guis_name.c_str());
+				CE_LOGE("gui '%s' does not exist.", guis_name.c_str());
 				return;
 			}
 
@@ -282,7 +282,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(font_name.c_str()))
 			{
-				Log::e("font '%s' does not exist.", font_name.c_str());
+				CE_LOGE("font '%s' does not exist.", font_name.c_str());
 				return;				
 			}
 
@@ -305,7 +305,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 			if (!fs.is_file(level_name.c_str()))
 			{
-				Log::e("level '%s' does not exist.", level_name.c_str());
+				CE_LOGE("level '%s' does not exist.", level_name.c_str());
 				return;				
 			}
 

+ 4 - 4
engine/resource/TextureResource.cpp

@@ -168,7 +168,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 	if (!in_file)
 	{
-		Log::e("Unable to open file: %s", resource_path);
+		CE_LOGE("Unable to open file: %s", resource_path);
 		return;
 	}
 
@@ -211,7 +211,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		}
 		default:
 		{
-			Log::e("Unable to determine TGA channels.");
+			CE_LOGE("Unable to determine TGA channels.");
 			return;
 		}
 	}
@@ -221,7 +221,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	{
 		case 0:
 		{
-			Log::e("The file does not contain image data: %s", resource_path);
+			CE_LOGE("The file does not contain image data: %s", resource_path);
 			return;
 		}
 		case 2:
@@ -238,7 +238,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 
 		default:
 		{
-			Log::e("Image type not supported.");
+			CE_LOGE("Image type not supported.");
 			return;
 		}
 	}

+ 1 - 1
engine/tests/decoders.cpp

@@ -18,7 +18,7 @@ int main(int argc, char** argv)
 
 	while(decoder.stream())
 	{
-		Log::i("size: %d", decoder.size());
+		CE_LOGI("size: %d", decoder.size());
 	}
 
 	engine->shutdown();

+ 11 - 11
engine/tests/dynamic-strings.cpp

@@ -6,31 +6,31 @@ using namespace crown;
 void creation_test()
 {
 	DynamicString string(default_allocator(), "Creation Test");
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string = "Creation Test OK!";
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 }
 
 //-----------------------------------------------------------------------------
 void equal_test()
 {
 	DynamicString string(default_allocator(), "Equal Test");
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	DynamicString string1(default_allocator(), "DynamicString assigned!");	
 
 	string = string1;
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string = "C-string assigned";
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string = 'C';
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string = "Equal Test OK!";
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 }
 
 //-----------------------------------------------------------------------------
@@ -40,16 +40,16 @@ void plus_equal_test()
 	DynamicString string1(default_allocator(), " DynamicString appended!");
 
 	string += string1;
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string += " C-string appended! ";
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string += 'C';
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 
 	string = "PlusEqual Test OK!";
-	Log::i("%s", string.c_str());
+	CE_LOGI("%s", string.c_str());
 }
 
 //-----------------------------------------------------------------------------

+ 4 - 4
engine/tests/events.cpp

@@ -29,7 +29,7 @@
 // 	ome.pressed = true;
 
 // 	g_write->push_event((uint32_t)OsEvent::MOUSE, &ome, sizeof(OsMouseEvent));
-// 	Log::i("Event pushed");
+// 	CE_LOGI("Event pushed");
 // }
 
 // //-----------------------------------------------------------------------------
@@ -41,7 +41,7 @@
 // 	g_write = g_read;
 // 	g_read = tmp;
 
-// 	Log::i("Buffers swapped");
+// 	CE_LOGI("Buffers swapped");
 // }
 
 // //-----------------------------------------------------------------------------
@@ -54,7 +54,7 @@
 
 // 	while (true)
 // 	{
-// 		Log::i("%p", g_read);
+// 		CE_LOGI("%p", g_read);
 		
 // 		do
 // 		{
@@ -62,7 +62,7 @@
 
 // 			if (result != NULL)
 // 			{
-// 				Log::d("x: %d, y: %d", result->x, result->y);
+// 				CE_LOGD("x: %d, y: %d", result->x, result->y);
 // 			}
 // 		}
 // 		while (result != NULL);

+ 3 - 3
engine/tests/json.cpp

@@ -33,9 +33,9 @@ int main()
 
     CE_ASSERT(root.has_key("glossary"), "'glossary' not found!");
 
-    Log::i("%s", root.key("glossary").key("GlossDiv").key("title").to_string());
-    Log::i("%s", root.key("glossary").key("title").to_string());
-    Log::i("%s", root.key("glossary").key("GlossDiv").key("GlossList").key("GlossEntry").key("GlossTerm").to_string());
+    CE_LOGI("%s", root.key("glossary").key("GlossDiv").key("title").to_string());
+    CE_LOGI("%s", root.key("glossary").key("title").to_string());
+    CE_LOGI("%s", root.key("glossary").key("GlossDiv").key("GlossList").key("GlossEntry").key("GlossTerm").to_string());
 
 
 	return 0;

+ 14 - 14
engine/world/World.cpp

@@ -316,9 +316,9 @@ void World::process_physics_events()
 	{
 		event_stream::Header h = *(event_stream::Header*) ee;
 
-		// Log::d("=== PHYSICS EVENT ===");
-		// Log::d("type = %d", h.type);
-		// Log::d("size = %d", h.size);
+		// CE_LOGD("=== PHYSICS EVENT ===");
+		// CE_LOGD("type = %d", h.type);
+		// CE_LOGD("size = %d", h.size);
 
 		const char* event = ee + sizeof(event_stream::Header);
 
@@ -328,13 +328,13 @@ void World::process_physics_events()
 			{
 				physics_world::CollisionEvent coll_ev = *(physics_world::CollisionEvent*) event;
 
-				// Log::d("type    = %s", coll_ev.type == physics_world::CollisionEvent::BEGIN_TOUCH ? "begin" : "end");
-				// Log::d("actor_0 = (%p)", coll_ev.actors[0]);
-				// Log::d("actor_1 = (%p)", coll_ev.actors[1]);
-				// Log::d("unit_0  = (%p)", coll_ev.actors[0]->unit());
-				// Log::d("unit_1  = (%p)", coll_ev.actors[1]->unit());
-				// Log::d("where   = (%f %f %f)", coll_ev.where.x, coll_ev.where.y, coll_ev.where.z);
-				// Log::d("normal  = (%f %f %f)", coll_ev.normal.x, coll_ev.normal.y, coll_ev.normal.z);
+				// CE_LOGD("type    = %s", coll_ev.type == physics_world::CollisionEvent::BEGIN_TOUCH ? "begin" : "end");
+				// CE_LOGD("actor_0 = (%p)", coll_ev.actors[0]);
+				// CE_LOGD("actor_1 = (%p)", coll_ev.actors[1]);
+				// CE_LOGD("unit_0  = (%p)", coll_ev.actors[0]->unit());
+				// CE_LOGD("unit_1  = (%p)", coll_ev.actors[1]->unit());
+				// CE_LOGD("where   = (%f %f %f)", coll_ev.where.x, coll_ev.where.y, coll_ev.where.z);
+				// CE_LOGD("normal  = (%f %f %f)", coll_ev.normal.x, coll_ev.normal.y, coll_ev.normal.z);
 
 				device()->lua_environment()->call_physics_callback(
 					coll_ev.actors[0],
@@ -350,9 +350,9 @@ void World::process_physics_events()
 			{
 				// physics_world::TriggerEvent trigg_ev = *(physics_world::TriggerEvent*) event;
 
-				// Log::d("type    = %s", trigg_ev.type == physics_world::TriggerEvent::BEGIN_TOUCH ? "begin" : "end");
-				// Log::d("trigger = (%p)", trigg_ev.trigger);
-				// Log::d("other   = (%p)", trigg_ev.other);
+				// CE_LOGD("type    = %s", trigg_ev.type == physics_world::TriggerEvent::BEGIN_TOUCH ? "begin" : "end");
+				// CE_LOGD("trigger = (%p)", trigg_ev.trigger);
+				// CE_LOGD("other   = (%p)", trigg_ev.other);
 				break;
 			}
 			default:
@@ -362,7 +362,7 @@ void World::process_physics_events()
 			}
 		}
 
-		// Log::d("=====================");
+		// CE_LOGD("=====================");
 
 		// Next event
 		ee += sizeof(event_stream::Header) + h.size;