TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.09k stars 222 forks source link

Add Debug Log Levels #126

Closed Alivent closed 7 years ago

Alivent commented 7 years ago

Currently the only logging levels are: Fatal Error Warn Info There should also a Debug and Trace log levels to track things while debugging the game.

define SPARKY_LOG_LEVEL_FATAL 0

define SPARKY_LOG_LEVEL_ERROR 1

define SPARKY_LOG_LEVEL_WARN 2

define SPARKY_LOG_LEVEL_INFO 3

define SPARKY_LOG_LEVEL_DEBUG 4

define SPARKY_LOG_LEVEL_TRACE 5

and add to the log defines

if SPARKY_LOG_LEVEL >= SPARKY_LOG_LEVEL_DEBUG

define SP_DEBUG(...) sp::internal::log_message(SPARKY_LOG_LEVEL_DEBUG, true, "SPARKY: ", VA_ARGS)

define _SP_DEBUG(...) sp::internal::log_message(SPARKY_LOG_LEVEL_DEBUG, false, __VA_ARGS__)

else

define SP_DEBUG(...)

define _SP_DEBUG(...)

endif

if SPARKY_LOG_LEVEL >= SPARKY_LOG_LEVEL_TRACE

define SP_TRACE(...) sp::internal::log_message(SPARKY_LOG_LEVEL_TRACE, true, "SPARKY: ", VA_ARGS)

define _SP_TRACE(...) sp::internal::log_message(SPARKY_LOG_LEVEL_TRACE, false, __VA_ARGS__)

else

define SP_TRACE(...)

define _SP_TRACE(...)

endif

TheCherno commented 7 years ago

You realise you can just open a pull request, right? I mean, you've basically written all the code.

Alivent commented 7 years ago

Oh I didn't realize that! Sorry