Skip to content

Commit

Permalink
Cleanup|Client: Log entries, levels, and domains (continued)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 11, 2014
1 parent 836d799 commit 71a20b3
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 212 deletions.
3 changes: 1 addition & 2 deletions doomsday/client/src/con_data.cpp
Expand Up @@ -1069,8 +1069,7 @@ static void printCommandUsage(ccmd_t *ccmd, bool allOverloads = true)
while(ccmd->prevOverload) { ccmd = ccmd->prevOverload; }
}

LOG_SCR_MSG(_E(D) "Usage:");
LOG_SCR_MSG(" " _E(>) + Con_CmdUsageAsStyledText(ccmd));
LOG_SCR_NOTE(_E(b) "Usage:" _E(.) "\n " _E(>) + Con_CmdUsageAsStyledText(ccmd));

if(allOverloads)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/con_main.cpp
Expand Up @@ -2270,7 +2270,7 @@ D_CMD(Help)

//Con_PrintRuler();

LOG_SCR_NOTE(_E(1) DOOMSDAY_NICENAME " " DOOMSDAY_VERSION_TEXT " Console");
LOG_SCR_NOTE(_E(b) DOOMSDAY_NICENAME " " DOOMSDAY_VERSION_TEXT " Console");

#define TABBED(A, B) "\n" _E(Ta) _E(b) " " << A << " " _E(.) _E(Tb) << B

Expand Down
47 changes: 30 additions & 17 deletions doomsday/client/src/def_main.cpp
Expand Up @@ -827,7 +827,7 @@ static void readDefinitionFile(String path)
if(path.isEmpty()) return;

QByteArray pathUtf8 = path.toUtf8();
LOG_RES_VERBOSE("Reading '%s'...") << F_PrettyPath(pathUtf8.constData());
LOG_RES_VERBOSE("Reading \"%s\"") << F_PrettyPath(pathUtf8.constData());
Def_ReadProcessDED(pathUtf8);
}

Expand Down Expand Up @@ -1434,6 +1434,8 @@ static void clearFontDefinitionLinks()

void Def_Read()
{
LOG_AS("Def_Read");

if(defsInited)
{
// We've already initialized the definitions once.
Expand All @@ -1459,7 +1461,7 @@ void Def_Read()
generateMaterialDefs();

// Read all definitions files and lumps.
Con_Message("Parsing definition files%s", verbose >= 1? ":" : "...");
LOG_RES_MSG("Parsing definition files...");
readAllDefinitions();

// Any definition hooks?
Expand Down Expand Up @@ -1637,7 +1639,7 @@ void Def_Read()
// It's probably a bias light definition, then?
if(!defs.lights[i].uniqueMapID[0])
{
Con_Message("Warning: Def_Read: Undefined state '%s' in Light definition.", defs.lights[i].state);
LOG_RES_WARNING("Undefined state '%s' in Light definition") << defs.lights[i].state;
}
continue;
}
Expand Down Expand Up @@ -2352,22 +2354,27 @@ int Def_Set(int type, int index, int value, const void* ptr)
ded_music_t* musdef = 0;
int i;

LOG_AS("Def_Set");

switch(type)
{
case DD_DEF_TEXT:
if(index < 0 || index >= defs.count.text.num)
Con_Error("Def_Set: Text index %i is invalid.\n", index);

{
DENG_ASSERT(!"Def_Set: Text index is invalid");
return false;
}
defs.text[index].text = (char*) M_Realloc(defs.text[index].text, strlen((char*)ptr) + 1);
strcpy(defs.text[index].text, (char const*) ptr);
break;

case DD_DEF_STATE: {
ded_state_t* stateDef;

if(index < 0 || index >= defs.count.states.num)
Con_Error("Def_Set: State index %i is invalid.\n", index);

{
DENG_ASSERT(!"Def_Set: State index is invalid");
return false;
}
stateDef = &defs.states[index];
switch(value)
{
Expand All @@ -2376,7 +2383,7 @@ int Def_Set(int type, int index, int value, const void* ptr)

if(sprite < 0 || sprite >= defs.count.sprites.num)
{
Con_Message("Warning: Def_Set: Unknown sprite index %i.", sprite);
LOGDEV_RES_WARNING("Unknown sprite index %i") << sprite;
break;
}

Expand All @@ -2393,7 +2400,10 @@ int Def_Set(int type, int index, int value, const void* ptr)

case DD_DEF_SOUND:
if(index < 0 || index >= countSounds.num)
Con_Error("Warning: Def_Set: Sound index %i is invalid.\n", index);
{
DENG_ASSERT(!"Sound index is invalid");
return false;
}

switch(value)
{
Expand All @@ -2405,8 +2415,8 @@ int Def_Set(int type, int index, int value, const void* ptr)
sounds[index].lumpNum = App_FileSystem().lumpNumForName(sounds[index].lumpName);
if(sounds[index].lumpNum < 0)
{
Con_Message("Warning: Def_Set: Unknown sound lump name \"%s\", sound (#%i) will be inaudible.",
sounds[index].lumpName, index);
LOG_RES_WARNING("Unknown sound lump name \"%s\"; sound #%i will be inaudible")
<< sounds[index].lumpName << index;
}
}
else
Expand All @@ -2432,7 +2442,10 @@ int Def_Set(int type, int index, int value, const void* ptr)
musdef = defs.music + index;
}
else
Con_Error("Def_Set: Music index %i is invalid.\n", index);
{
DENG_ASSERT(!"Def_Set: Music index is invalid");
return false;
}

// Which key to set?
switch(value)
Expand Down Expand Up @@ -2519,17 +2532,17 @@ D_CMD(ListMobjs)

if(defs.count.mobjs.num <= 0)
{
Con_Message("There are currently no mobjtypes defined/loaded.");
LOG_RES_MSG("No mobjtypes defined/loaded");
return true;
}

Con_Printf("Registered Mobjs (ID | Name):\n");
LOG_RES_MSG(_E(b) "Registered Mobjs (ID | Name):");
for(int i = 0; i < defs.count.mobjs.num; ++i)
{
if(defs.mobjs[i].name[0])
Con_Printf(" %s | %s\n", defs.mobjs[i].id, defs.mobjs[i].name);
LOG_RES_MSG(" %s | %s") << defs.mobjs[i].id << defs.mobjs[i].name;
else
Con_Printf(" %s | (Unnamed)\n", defs.mobjs[i].id);
LOG_RES_MSG(" %s | " _E(l) "(Unnamed)") << defs.mobjs[i].id;
}

return true;
Expand Down
27 changes: 11 additions & 16 deletions doomsday/client/src/filesys/fs_main.cpp
Expand Up @@ -1095,8 +1095,7 @@ void FS1::clearPathMappings()

void FS1::printDirectory(Path path)
{
QByteArray pathUtf8 = NativePath(path).pretty().toUtf8();
Con_Message("Directory: %s", pathUtf8.constData());
LOG_RES_MSG(_E(b) "Directory: %s") << NativePath(path).pretty();

// We are interested in *everything*.
path = path / "*";
Expand All @@ -1108,8 +1107,7 @@ void FS1::printDirectory(Path path)

DENG2_FOR_EACH_CONST(PathList, i, found)
{
QByteArray foundPath = NativePath(i->path).pretty().toUtf8();
Con_Message(" %s", foundPath.constData());
LOG_RES_MSG(" %s") << NativePath(i->path).pretty();
}
}
}
Expand Down Expand Up @@ -1172,10 +1170,9 @@ D_CMD(DumpLump)
{
return F_DumpLump(lumpNum);
}
Con_Printf("No such lump.\n");
LOG_RES_ERROR("No such lump");
return false;
}
Con_Printf("WAD module is not presently initialized.\n");
return false;
}

Expand All @@ -1190,7 +1187,6 @@ D_CMD(ListLumps)
return true;
}

LOG_SCR_WARNING("File system is not initialized");
return false;
}

Expand All @@ -1199,7 +1195,7 @@ D_CMD(ListFiles)
{
DENG_UNUSED(src); DENG_UNUSED(argc); DENG_UNUSED(argv);

Con_Printf("Loaded Files (in load order):\n");
LOG_RES_MSG(_E(b) "Loaded Files " _E(l) "(in load order)" _E(w) ":");

size_t totalFiles = 0, totalPackages = 0;
if(fileSystem)
Expand All @@ -1224,19 +1220,18 @@ D_CMD(ListFiles)
crc = (!file.hasCustom()? wad->calculateCRC() : 0);
}

QByteArray path = de::NativePath(file.composePath()).pretty().toUtf8();
Con_Printf("\"%s\" (%i %s%s)", path.constData(),
fileCount, fileCount != 1 ? "files" : "file",
(file.hasStartup()? ", startup" : ""));
if(0 != crc)
Con_Printf(" [%08x]", crc);
Con_Printf("\n");
LOG_RES_MSG(" %s " _E(2)_E(>) "(%i %s%s)%s")
<< de::NativePath(file.composePath()).pretty()
<< fileCount << (fileCount != 1 ? "files" : "file")
<< (file.hasStartup()? ", startup" : "")
<< (crc? QString(" [%1]").arg(crc, 0, 16) : "");

totalFiles += size_t(fileCount);
++totalPackages;
}
}
Con_Printf("Total: %lu files in %lu packages.\n", (unsigned long) totalFiles, (unsigned long)totalPackages);
LOG_RES_MSG(_E(b)"Total: " _E(.) "%i files in %i packages")
<< totalFiles << totalPackages;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/game.cpp
Expand Up @@ -271,7 +271,7 @@ D_CMD(InspectGame)

DENG2_ASSERT(!game->isNull());

LOG_MSG(_E(1) "%s - %s") << game->title() << game->author();
LOG_MSG(_E(b) "%s - %s") << game->title() << game->author();
LOG_MSG(_E(l) "IdentityKey: " _E(.) _E(i) "%s " _E(.)
_E(l) "PluginId: " _E(.) _E(i) "%s")
<< game->identityKey() << int(game->pluginId());
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/games.cpp
Expand Up @@ -250,7 +250,7 @@ D_CMD(ListGames)
return true;
}

LOG_MSG(_E(1) "Registered Games:");
LOG_MSG(_E(b) "Registered Games:");
LOG_VERBOSE("Key: %s'!'=Incomplete/Not playable %s'*'=Loaded")
<< _E(>) _E(D) << _E(B);

Expand Down Expand Up @@ -291,7 +291,7 @@ D_CMD(ListGames)

LOG_MSG(_E(R) "\n");
LOG_MSG("%i of %i games are playable") << numCompleteGames << games.count();
LOG_SCR_MSG("Use the " _E(b) "load" _E(.) "command to load a game. For example: \"load gamename\".");
LOG_SCR_MSG("Use the " _E(b) "load" _E(.) " command to load a game. For example: \"load gamename\".");

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/render/rend_halo.cpp
Expand Up @@ -393,9 +393,9 @@ D_CMD(FlareConfig)
}
else
{
Con_Printf("Usage:\n");
Con_Printf(" %s list\n", argv[0]);
Con_Printf(" %s (num) pos/size/alpha/tex (val)\n", argv[0]);
LOG_SCR_MSG("Usage:\n"
" %s list\n"
" %s (num) pos/size/alpha/tex (val)") << argv[0] << argv[0];
}

return true;
Expand Down
57 changes: 21 additions & 36 deletions doomsday/client/src/render/viewports.cpp
Expand Up @@ -574,15 +574,15 @@ void R_UpdateViewer(int consoleNum)
OldAngle *old = &oldAngle[viewPlayer - ddPlayers];
float yaw = (double)smoothView.angle() / ANGLE_MAX * 360;

Con_Message("(%i) F=%.3f dt=%-10.3f dx=%-10.3f dy=%-10.3f "
"Rdx=%-10.3f Rdy=%-10.3f",
SECONDS_TO_TICKS(gameTime),
frameTimePos,
sysTime - old->time,
yaw - old->yaw,
smoothView.pitch - old->pitch,
(yaw - old->yaw) / (sysTime - old->time),
(smoothView.pitch - old->pitch) / (sysTime - old->time));
LOGDEV_MSG("(%i) F=%.3f dt=%-10.3f dx=%-10.3f dy=%-10.3f "
"Rdx=%-10.3f Rdy=%-10.3f")
<< SECONDS_TO_TICKS(gameTime)
<< frameTimePos
<< sysTime - old->time
<< yaw - old->yaw
<< smoothView.pitch - old->pitch
<< (yaw - old->yaw) / (sysTime - old->time)
<< (smoothView.pitch - old->pitch) / (sysTime - old->time);

old->yaw = yaw;
old->pitch = smoothView.pitch;
Expand All @@ -600,16 +600,15 @@ void R_UpdateViewer(int consoleNum)
static OldPos oldPos[DDMAXPLAYERS];
OldPos *old = &oldPos[viewPlayer - ddPlayers];

Con_Message("(%i) F=%.3f dt=%-10.3f dx=%-10.3f dy=%-10.3f dz=%-10.3f dx/dt=%-10.3f dy/dt=%-10.3f",
//"Rdx=%-10.3f Rdy=%-10.3f\n",
SECONDS_TO_TICKS(gameTime),
frameTimePos,
sysTime - old->time,
smoothView.origin.x - old->pos.x,
smoothView.origin.y - old->pos.y,
smoothView.origin.z - old->pos.z,
(smoothView.origin.x - old->pos.x) / (sysTime - old->time),
(smoothView.origin.y - old->pos.y) / (sysTime - old->time));
LOGDEV_MSG("(%i) F=%.3f dt=%-10.3f dx=%-10.3f dy=%-10.3f dz=%-10.3f dx/dt=%-10.3f dy/dt=%-10.3f")
<< SECONDS_TO_TICKS(gameTime)
<< frameTimePos
<< sysTime - old->time
<< smoothView.origin.x - old->pos.x
<< smoothView.origin.y - old->pos.y
<< smoothView.origin.z - old->pos.z
<< (smoothView.origin.x - old->pos.x) / (sysTime - old->time)
<< (smoothView.origin.y - old->pos.y) / (sysTime - old->time);

old->pos = smoothView.origin;
old->time = sysTime;
Expand Down Expand Up @@ -656,7 +655,7 @@ void R_SetupFrame(player_t *player)

if(showFrameTimePos)
{
Con_Printf("frametime = %f\n", frameTimePos);
LOGDEV_VERBOSE("frametime = %f") << frameTimePos;
}

// Handle extralight (used to light up the world momentarily (used for
Expand Down Expand Up @@ -933,20 +932,6 @@ DENG_EXTERN_C void R_RenderPlayerView(int num)
player->shared.mo->ddFlags = oldFlags;
}

// Should we be counting triangles?
/*if(rendInfoTris)
{
// This count includes all triangles drawn since R_SetupFrame.
Con_Printf("Tris: %-4i (Mdl=%-4i)\n", polyCounter, modelTriCount);
modelTriCount = 0;
polyCounter = 0;
}*/

/*if(rendInfoLums)
{
Con_Printf("LumObjs: %-4i\n", LO_GetNumLuminous());
}*/

R_PrintRendPoolInfo();

#ifdef LIBDENG_CAMERA_MOVEMENT_ANALYSIS
Expand All @@ -960,8 +945,8 @@ DENG_EXTERN_C void R_RenderPlayerView(int num)
float time = sysTime - devCameraMovementStartTime;
float elapsed = time - prevTime;

Con_Message("%f,%f,%f,%f,%f", Sys_GetRealSeconds() - devCameraMovementStartTimeRealSecs,
time, elapsed, speed/elapsed, speed/elapsed - prevSpeed);
LOGDEV_MSG("%f,%f,%f,%f,%f") << Sys_GetRealSeconds() - devCameraMovementStartTimeRealSecs
<< time << elapsed << speed/elapsed << speed/elapsed - prevSpeed;

V3f_Copy(prevPos, vd->current.pos);
prevSpeed = speed/elapsed;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/resource/resourcesystem.cpp
Expand Up @@ -4279,7 +4279,7 @@ D_CMD(PrintMaterialStats)
{
DENG2_UNUSED3(src, argc, argv);

LOG_MSG(_E(1) "Material Statistics:");
LOG_MSG(_E(b) "Material Statistics:");
foreach(MaterialScheme *scheme, App_ResourceSystem().allMaterialSchemes())
{
MaterialScheme::Index const &index = scheme->index();
Expand All @@ -4297,7 +4297,7 @@ D_CMD(PrintTextureStats)
{
DENG2_UNUSED3(src, argc, argv);

LOG_MSG(_E(1) "Texture Statistics:");
LOG_MSG(_E(b) "Texture Statistics:");
foreach(TextureScheme *scheme, App_ResourceSystem().allTextureSchemes())
{
TextureScheme::Index const &index = scheme->index();
Expand All @@ -4316,7 +4316,7 @@ D_CMD(PrintFontStats)
{
DENG2_UNUSED3(src, argc, argv);

LOG_MSG(_E(1) "Font Statistics:");
LOG_MSG(_E(b) "Font Statistics:");
foreach(FontScheme *scheme, App_ResourceSystem().allFontSchemes())
{
FontScheme::Index const &index = scheme->index();
Expand Down

0 comments on commit 71a20b3

Please sign in to comment.