Permalink
Browse files

Logging part 1

  • Loading branch information...
1 parent 09999e6 commit 37f1f364bc4cbe195075028dca2c6a55523062df @TimePath TimePath committed with Kangz Jan 21, 2016
Showing with 605 additions and 734 deletions.
  1. +2 −0 daemon/src/common/Log.cpp
  2. +4 −3 daemon/src/common/Log.h
  3. +11 −11 daemon/src/engine/botlib/bot_load.cpp
  4. +1 −1 daemon/src/engine/botlib/bot_local.cpp
  5. +2 −2 daemon/src/engine/client/cin_ogm.cpp
  6. +1 −1 daemon/src/engine/client/cl_avi.cpp
  7. +2 −2 daemon/src/engine/client/cl_cgame.cpp
  8. +3 −3 daemon/src/engine/client/cl_cin.cpp
  9. +1 −1 daemon/src/engine/client/cl_console.cpp
  10. +1 −1 daemon/src/engine/client/cl_input.cpp
  11. +1 −1 daemon/src/engine/client/cl_keys.cpp
  12. +39 −39 daemon/src/engine/client/cl_main.cpp
  13. +1 −1 daemon/src/engine/client/cl_parse.cpp
  14. +4 −4 daemon/src/engine/client/dl_main.cpp
  15. +2 −74 daemon/src/engine/qcommon/common.cpp
  16. +2 −2 daemon/src/engine/qcommon/files.cpp
  17. +0 −31 daemon/src/engine/qcommon/logging.h
  18. +1 −1 daemon/src/engine/qcommon/net_ip.cpp
  19. +3 −3 daemon/src/engine/qcommon/q_shared.cpp
  20. +0 −3 daemon/src/engine/qcommon/qcommon.h
  21. +1 −1 daemon/src/engine/renderer/tr_image.cpp
  22. +1 −1 daemon/src/engine/renderer/tr_init.cpp
  23. +28 −28 daemon/src/engine/server/sv_client.cpp
  24. +6 −6 daemon/src/engine/server/sv_main.cpp
  25. +1 −1 daemon/src/engine/server/sv_net_chan.cpp
  26. +6 −6 daemon/src/engine/server/sv_snapshot.cpp
  27. +17 −17 daemon/src/engine/sys/sdl_input.cpp
  28. +2 −2 src/cgame/cg_animation.cpp
  29. +3 −3 src/cgame/cg_attachment.cpp
  30. +9 −9 src/cgame/cg_buildable.cpp
  31. +2 −2 src/cgame/cg_consolecmds.cpp
  32. +2 −2 src/cgame/cg_ents.cpp
  33. +95 −95 src/cgame/cg_event.cpp
  34. +1 −1 src/cgame/cg_gameinfo.cpp
  35. +0 −1 src/cgame/cg_local.h
  36. +3 −15 src/cgame/cg_main.cpp
  37. +17 −17 src/cgame/cg_minimap.cpp
  38. +41 −41 src/cgame/cg_particles.cpp
  39. +17 −17 src/cgame/cg_players.cpp
  40. +1 −1 src/cgame/cg_playerstate.cpp
  41. +8 −8 src/cgame/cg_predict.cpp
  42. +1 −1 src/cgame/cg_rocket_dataformatter.cpp
  43. +1 −1 src/cgame/cg_rocket_datasource.cpp
  44. +1 −1 src/cgame/cg_rocket_draw.cpp
  45. +22 −22 src/cgame/cg_servercmds.cpp
  46. +1 −1 src/cgame/cg_snapshot.cpp
  47. +29 −29 src/cgame/cg_trails.cpp
  48. +1 −1 src/cgame/cg_utils.cpp
  49. +7 −7 src/cgame/cg_view.cpp
  50. +24 −24 src/cgame/cg_weapons.cpp
  51. +1 −1 src/cgame/rocket/rocket.cpp
  52. +4 −4 src/cgame/rocket/rocket_keys.cpp
  53. +4 −4 src/sgame/sg_active.cpp
  54. +4 −4 src/sgame/sg_admin.cpp
  55. +3 −3 src/sgame/sg_bot.cpp
  56. +1 −1 src/sgame/sg_bot_ai.cpp
  57. +2 −2 src/sgame/sg_bot_parse.cpp
  58. +13 −13 src/sgame/sg_buildable.cpp
  59. +2 −2 src/sgame/sg_cmds.cpp
  60. +2 −2 src/sgame/sg_combat.cpp
  61. +11 −11 src/sgame/sg_entities.cpp
  62. +14 −26 src/sgame/sg_main.cpp
  63. +32 −32 src/sgame/sg_maprotation.cpp
  64. +1 −1 src/sgame/sg_missile.cpp
  65. +0 −1 src/sgame/sg_public.h
  66. +13 −13 src/sgame/sg_spawn.cpp
  67. +2 −2 src/sgame/sg_spawn_afx.cpp
  68. +5 −5 src/sgame/sg_spawn_mover.cpp
  69. +6 −6 src/sgame/sg_spawn_sensor.cpp
  70. +3 −3 src/sgame/sg_spawn_shared.cpp
  71. +50 −50 src/sgame/sg_svcmds.cpp
  72. +3 −3 src/sgame/sg_utils.cpp
@@ -44,6 +44,8 @@ namespace Log {
}
}
+ Logger defaultLogger("common.default", "", Level::NOTICE);
+
bool ParseCvarValue(std::string value, Log::Level& result) {
if (value == "warning" or value == "warn") {
result = Log::Level::WARNING;
@@ -234,15 +234,16 @@ namespace Log {
}
// Quick Logs
+ extern Logger defaultLogger;
template<typename ... Args>
void Warn(Str::StringRef format, Args&& ... args) {
- CodeSourceWarn(Str::Format(format, std::forward<Args>(args) ...));
+ defaultLogger.Warn(format, std::forward<Args>(args) ...);
}
template<typename ... Args>
void Notice(Str::StringRef format, Args&& ... args) {
- CodeSourceNotice(Str::Format(format, std::forward<Args>(args) ...));
+ defaultLogger.Notice(format, std::forward<Args>(args) ...);
}
template<typename ... Args>
@@ -252,7 +253,7 @@ namespace Log {
template<typename ... Args>
void Debug(Str::StringRef format, Args&& ... args) {
- CodeSourceDebug(Str::Format(format, std::forward<Args>(args) ...));
+ defaultLogger.Debug(format, std::forward<Args>(args) ...);
}
}
@@ -169,13 +169,13 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( !f )
{
- Com_Log(log_level_t::ERROR, "Cannot open Navigaton Mesh file" );
+ Log::Warn("Cannot open Navigaton Mesh file" );
return false;
}
if ( len < 0 )
{
- Com_Log(log_level_t::ERROR, "Negative Length for Navigation Mesh file");
+ Log::Warn("Negative Length for Navigation Mesh file");
return false;
}
@@ -187,14 +187,14 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( header.magic != NAVMESHSET_MAGIC )
{
- Com_Log(log_level_t::ERROR, "File is wrong magic" );
+ Log::Warn("File is wrong magic" );
FS_FCloseFile( f );
return false;
}
if ( header.version != NAVMESHSET_VERSION )
{
- Com_Logf(log_level_t::ERROR, "File is wrong version found: %d want: %d", header.version, NAVMESHSET_VERSION );
+ Log::Warn("File is wrong version found: %d want: %d", header.version, NAVMESHSET_VERSION );
FS_FCloseFile( f );
return false;
}
@@ -203,7 +203,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( !nav.mesh )
{
- Com_Log(log_level_t::ERROR, "Unable to allocate nav mesh" );
+ Log::Warn("Unable to allocate nav mesh" );
FS_FCloseFile( f );
return false;
}
@@ -212,7 +212,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( dtStatusFailed( status ) )
{
- Com_Log(log_level_t::ERROR, "Could not init navmesh" );
+ Log::Warn("Could not init navmesh" );
dtFreeNavMesh( nav.mesh );
nav.mesh = nullptr;
FS_FCloseFile( f );
@@ -223,7 +223,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( !nav.cache )
{
- Com_Log(log_level_t::ERROR, "Could not allocate tile cache" );
+ Log::Warn("Could not allocate tile cache" );
dtFreeNavMesh( nav.mesh );
nav.mesh = nullptr;
FS_FCloseFile( f );
@@ -234,7 +234,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( dtStatusFailed( status ) )
{
- Com_Log(log_level_t::ERROR, "Could not init tile cache" );
+ Log::Warn("Could not init tile cache" );
dtFreeNavMesh( nav.mesh );
dtFreeTileCache( nav.cache );
nav.mesh = nullptr;
@@ -253,7 +253,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( !tileHeader.tileRef || !tileHeader.dataSize )
{
- Com_Log(log_level_t::ERROR, "NUll Tile in navmesh" );
+ Log::Warn("NUll Tile in navmesh" );
dtFreeNavMesh( nav.mesh );
dtFreeTileCache( nav.cache );
nav.cache = nullptr;
@@ -266,7 +266,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( !data )
{
- Com_Log(log_level_t::ERROR, "Failed to allocate memory for tile data" );
+ Log::Warn("Failed to allocate memory for tile data" );
dtFreeNavMesh( nav.mesh );
dtFreeTileCache( nav.cache );
nav.cache = nullptr;
@@ -289,7 +289,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )
if ( dtStatusFailed( status ) )
{
- Com_Log(log_level_t::ERROR, "Failed to add tile to navmesh" );
+ Log::Warn("Failed to add tile to navmesh" );
dtFree( data );
dtFreeTileCache( nav.cache );
dtFreeNavMesh( nav.mesh );
@@ -82,7 +82,7 @@ void FindWaypoints( Bot_t *bot, float *corners, unsigned char *cornerFlags, dtPo
{
if ( !bot->corridor.getPathCount() )
{
- Com_Log(log_level_t::ERROR, "FindWaypoints Called without a path!" );
+ Log::Warn("FindWaypoints Called without a path!" );
*numCorners = 0;
return;
}
@@ -318,7 +318,7 @@ static int loadVideoFrameTheora()
{
g_ogm.outputWidht = g_ogm.th_info.width;
g_ogm.outputHeight = g_ogm.th_info.height;
- Com_DPrintf( "[Theora(ogg)]new resolution %dx%d\n", g_ogm.outputWidht, g_ogm.outputHeight );
+ Log::Debug( "[Theora(ogg)]new resolution %dx%d", g_ogm.outputWidht, g_ogm.outputHeight );
}
if ( g_ogm.outputBufferSize < g_ogm.th_info.width * g_ogm.th_info.height )
@@ -688,7 +688,7 @@ int Cin_OGM_Init( const char *filename )
g_ogm.Vtime_unit = ( ( ogg_int64_t ) g_ogm.th_info.fps_denominator * 1000 * 10000 / g_ogm.th_info.fps_numerator );
}
- Com_DPrintf( "OGM-Init done (%s)\n", filename );
+ Log::Debug( "OGM-Init done (%s)", filename );
return 0;
}
@@ -337,7 +337,7 @@ bool CL_OpenAVIForWriting( const char *fileName )
// Don't start if a framerate has not been chosen
if ( cl_aviFrameRate->integer <= 0 )
{
- Com_Log(log_level_t::ERROR, "cl_aviFrameRate must be ≥ 1\n" );
+ Log::Warn("cl_aviFrameRate must be ≥ 1" );
return false;
}
@@ -606,7 +606,7 @@ static int LAN_ServerIsVisible( int source, int n )
if ( Cmd_Argc() == 1 )
{
- Com_Log(log_level_t::ERROR, "Server sent a pubkey_decrypt command, but sent nothing to decrypt!" );
+ Log::Warn("Server sent a pubkey_decrypt command, but sent nothing to decrypt!" );
return false;
}
@@ -714,7 +714,7 @@ void CL_InitCGame()
t2 = Sys_Milliseconds();
- Com_DPrintf( "CL_InitCGame: %5.2fs\n", ( t2 - t1 ) / 1000.0 );
+ Log::Debug( "CL_InitCGame: %5.2fs", ( t2 - t1 ) / 1000.0 );
// have the renderer touch all its images, so they are present
// on the card even if the driver does deferred loading
@@ -96,7 +96,7 @@ e_status CIN_StopCinematic( int handle )
currentHandle = handle;
- Com_DPrintf( "trFMV::stop(), closing %s\n", cinTable[ currentHandle ].fileName );
+ Log::Debug( "trFMV::stop(), closing %s", cinTable[ currentHandle ].fileName );
if ( !cinTable[ currentHandle ].buf )
{
@@ -371,7 +371,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
}
}
- Com_DPrintf( "SCR_PlayCinematic( %s )\n", arg );
+ Log::Debug( "SCR_PlayCinematic( %s )", arg );
Com_Memset( &cin, 0, sizeof( cinematics_t ) );
currentHandle = CIN_HandleForVideo();
@@ -556,7 +556,7 @@ void CL_PlayCinematic_f()
return;
}
- Com_DPrintf( "CL_PlayCinematic_f\n" );
+ Log::Debug( "CL_PlayCinematic_f" );
if ( cls.state == connstate_t::CA_CINEMATIC )
{
@@ -166,7 +166,7 @@ void Con_Dump_f()
if ( !f )
{
- Com_Log(log_level_t::ERROR, "couldn't open." );
+ Log::Warn("couldn't open." );
return;
}
@@ -95,7 +95,7 @@ void IN_KeyDown( kbutton_t *b )
}
else
{
- Com_DPrintf( "Three keys down for a button!" );
+ Log::Debug( "Three keys down for a button!" );
return;
}
@@ -1995,7 +1995,7 @@ void Key_SetTeam( int newTeam )
if ( bindTeam != newTeam )
{
- Com_DPrintf( "%sSetting binding team index to %d\n",
+ Log::Debug( "%sSetting binding team index to %d",
Color::CString( Color::Green ),
newTeam );
}
Oops, something went wrong.

0 comments on commit 37f1f36

Please sign in to comment.