From ad93df030fd9e77269dd4f781efb0ba93518ecce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Sun, 12 Jan 2014 13:50:57 +0200 Subject: [PATCH] Refactor: Added App_Log() to the libdeng2 C wrapper, use it everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit App_Log() works the same way as the LOG_* macros: a newline is automatically added (if there isn’t one). Replaced applicable use of LogBuffer_Printf() with App_Log() calls. --- doomsday/client/src/con_main.cpp | 2 +- doomsday/client/src/dd_plugin.cpp | 10 -- doomsday/client/src/library.cpp | 8 +- doomsday/client/src/render/rend_font.cpp | 1 - doomsday/libdeng1/src/memoryzone.c | 26 ++--- doomsday/libdeng1/src/reader.c | 2 +- doomsday/libdeng1/src/stack.c | 2 +- doomsday/libdeng1/src/writer.c | 4 +- doomsday/libdeng2/include/de/c_wrapper.h | 2 +- doomsday/libdeng2/src/c_wrapper.cpp | 99 ++++++++++++------- doomsday/plugins/common/src/d_netsv.c | 4 +- doomsday/plugins/common/src/fi_lib.c | 2 +- doomsday/plugins/common/src/g_game.c | 8 +- doomsday/plugins/common/src/p_player.c | 30 +++--- doomsday/plugins/common/src/p_saveg.cpp | 4 +- doomsday/plugins/common/src/p_saveio.c | 2 +- doomsday/plugins/common/src/p_start.cpp | 16 +-- doomsday/plugins/common/src/p_xgsec.c | 18 ++-- .../directsound/src/driver_directsound.cpp | 20 ++-- doomsday/plugins/doom/src/m_cheat.c | 62 ++++++------ doomsday/plugins/doom/src/st_stuff.c | 2 +- doomsday/plugins/doom64/src/m_cheat.c | 58 +++++------ doomsday/plugins/doom64/src/p_spec.c | 8 +- doomsday/plugins/doom64/src/st_stuff.c | 2 +- doomsday/plugins/example/src/example.c | 2 +- .../fluidsynth/src/fluidsynth_music.cpp | 12 +-- doomsday/plugins/heretic/src/m_cheat.c | 44 ++++----- doomsday/plugins/heretic/src/st_stuff.c | 2 +- doomsday/plugins/hexen/src/m_cheat.c | 46 ++++----- doomsday/plugins/hexen/src/st_stuff.c | 2 +- 30 files changed, 253 insertions(+), 247 deletions(-) diff --git a/doomsday/client/src/con_main.cpp b/doomsday/client/src/con_main.cpp index d6dcab1de9..9abf8d64f3 100644 --- a/doomsday/client/src/con_main.cpp +++ b/doomsday/client/src/con_main.cpp @@ -1023,7 +1023,7 @@ void Con_PrintRuler(void) if(ConsoleSilent) return; - LogBuffer_Msg(_E(R) "\n"); + LOG_MSG(_E(R)); } /// @param flags @ref consolePrintFlags diff --git a/doomsday/client/src/dd_plugin.cpp b/doomsday/client/src/dd_plugin.cpp index a004d9089f..a6552dc525 100644 --- a/doomsday/client/src/dd_plugin.cpp +++ b/doomsday/client/src/dd_plugin.cpp @@ -207,16 +207,6 @@ DENG_EXTERN_C int Plug_RemoveHook(int hookType, hookfunc_t hook) { int i, type = HOOKMASK(hookType); - /* - if(currentPlugin) - { - LogBuffer_Printf(DE2_LOG_WARNING, - "Plug_RemoveHook: Failed to remove hook %p of type %i; currently processing a hook.\n", - hook, hookType); - return false; - } - */ - // The type must be good. if(type < 0 || type >= NUM_HOOK_TYPES) return false; diff --git a/doomsday/client/src/library.cpp b/doomsday/client/src/library.cpp index 464f46e2d5..1857ee82c4 100644 --- a/doomsday/client/src/library.cpp +++ b/doomsday/client/src/library.cpp @@ -77,12 +77,12 @@ void Library_Shutdown(void) void Library_ReleaseGames(void) { #ifdef UNIX + LOG_AS("Library_ReleaseGames"); foreach(Library* lib, loadedLibs) { if(lib->isGamePlugin) { - LogBuffer_Printf(DE2_LOG_DEBUG, - "Library_ReleaseGames: Closing '%s'\n", Str_Text(lib->path)); + LOGDEV_RES_VERBOSE("Closing '%s'") << Str_Text(lib->path); // Close the Library. DENG_ASSERT(lib->file); @@ -99,8 +99,7 @@ static void reopenLibraryIfNeeded(Library* lib) if(!lib->file->loaded()) { - LogBuffer_Printf(DE2_LOG_DEBUG, - "reopenLibraryIfNeeded: Opening '%s'\n", Str_Text(lib->path)); + LOGDEV_RES_XVERBOSE("Re-opening '%s'") << Str_Text(lib->path); // Make sure the Library gets opened again now. lib->file->library(); @@ -227,6 +226,7 @@ void* Library_Symbol(Library* lib, const char* symbolName) { try { + LOG_AS("Library_Symbol"); DENG_ASSERT(lib); #ifdef UNIX reopenLibraryIfNeeded(lib); diff --git a/doomsday/client/src/render/rend_font.cpp b/doomsday/client/src/render/rend_font.cpp index b65ed1797b..91f5ad0010 100644 --- a/doomsday/client/src/render/rend_font.cpp +++ b/doomsday/client/src/render/rend_font.cpp @@ -174,7 +174,6 @@ void FR_SetFont(fontid_t num) } catch(ResourceSystem::UnknownFontIdError const &) {} - //LogBuffer_Printf(DE2_LOG_WARNING, "Requested invalid font %i.\n", num); } else { diff --git a/doomsday/libdeng1/src/memoryzone.c b/doomsday/libdeng1/src/memoryzone.c index 3b84674b40..18cefb1530 100644 --- a/doomsday/libdeng1/src/memoryzone.c +++ b/doomsday/libdeng1/src/memoryzone.c @@ -163,7 +163,7 @@ static memvolume_t *createVolume(size_t volumeSize) unlockZone(); - LogBuffer_Printf(DE2_LOG_MESSAGE, + App_Log(DE2_LOG_MESSAGE, "Created a new %.1f MB memory volume.\n", vol->size / 1024.0 / 1024.0); Z_CheckHeap(); @@ -208,7 +208,7 @@ void Z_Shutdown(void) M_Free(vol); } - LogBuffer_Printf(DE2_LOG_NOTE, + App_Log(DE2_LOG_NOTE, "Z_Shutdown: Used %i volumes, total %u bytes.\n", numVolumes, totalMemory); Sys_DestroyMutex(zoneMutex); @@ -259,7 +259,7 @@ static void freeBlock(void *ptr, memblock_t **tracked) { unlockZone(); DENG_ASSERT(block->id == LIBDENG_ZONEID); - LogBuffer_Printf(DE2_LOG_WARNING, + App_Log(DE2_LOG_WARNING, "Attempted to free pointer without ZONEID.\n"); return; } @@ -445,7 +445,7 @@ void *Z_Malloc(size_t size, int tag, void *user) if(tag < PU_APPSTATIC || tag > PU_PURGELEVEL) { - LogBuffer_Printf(DE2_LOG_WARNING, "Z_Malloc: Invalid purgelevel %i, cannot allocate memory.\n", tag); + App_Log(DE2_LOG_WARNING, "Z_Malloc: Invalid purgelevel %i, cannot allocate memory.\n", tag); return NULL; } if(!size) @@ -558,7 +558,7 @@ void *Z_Malloc(size_t size, int tag, void *user) { // Scanned all the way through, no suitable space found. gotoNextVolume = true; - LogBuffer_Printf(DE2_LOG_DEBUG, + App_Log(DE2_LOG_DEBUG, "Z_Malloc: gave up on volume after %i checks\n", numChecked); break; } @@ -676,7 +676,7 @@ void Z_FreeTags(int lowTag, int highTag) memvolume_t *volume; memblock_t *block, *next; - LogBuffer_Printf(DE2_LOG_DEBUG, + App_Log(DE2_LOG_DEBUG, "MemoryZone: Freeing all blocks in tag range:[%i, %i)\n", lowTag, highTag+1); @@ -711,7 +711,7 @@ void Z_CheckHeap(void) memblock_t *block; dd_bool isDone; - LogBuffer_Printf(DE2_LOG_TRACE, "Z_CheckHeap\n"); + App_Log(DE2_LOG_TRACE, "Z_CheckHeap\n"); lockZone(); @@ -722,7 +722,7 @@ void Z_CheckHeap(void) // Validate the counter. if(allocatedMemoryInVolume(volume) != volume->allocatedBytes) { - LogBuffer_Printf(DE2_LOG_CRITICAL, + App_Log(DE2_LOG_CRITICAL, "Z_CheckHeap: allocated bytes counter is off (counter:%u != actual:%u)\n", volume->allocatedBytes, allocatedMemoryInVolume(volume)); App_FatalError("Z_CheckHeap: zone book-keeping is wrong"); @@ -736,7 +736,7 @@ void Z_CheckHeap(void) } if(total != volume->size - sizeof(memzone_t)) { - LogBuffer_Printf(DE2_LOG_CRITICAL, + App_Log(DE2_LOG_CRITICAL, "Z_CheckHeap: invalid total size of blocks (%u != %u)\n", total, volume->size - sizeof(memzone_t)); App_FatalError("Z_CheckHeap: zone book-keeping is wrong"); @@ -746,7 +746,7 @@ void Z_CheckHeap(void) block = volume->zone->blockList.prev; if((byte *)block - ((byte *)volume->zone + sizeof(memzone_t)) + block->size != volume->size - sizeof(memzone_t)) { - LogBuffer_Printf(DE2_LOG_CRITICAL, + App_Log(DE2_LOG_CRITICAL, "Z_CheckHeap: last block does not cover the end (%u != %u)\n", (byte *)block - ((byte *)volume->zone + sizeof(memzone_t)) + block->size, volume->size - sizeof(memzone_t)); @@ -820,7 +820,7 @@ void Z_ChangeTag2(void *ptr, int tag) if(tag >= PU_PURGELEVEL && PTR2INT(block->user) < 0x100) { - LogBuffer_Printf(DE2_LOG_ERROR, + App_Log(DE2_LOG_ERROR, "Z_ChangeTag: An owner is required for purgable blocks.\n"); } else @@ -1038,7 +1038,7 @@ void Z_PrintStatus(void) size_t allocated = Z_AllocatedMemory(); size_t wasted = Z_FreeMemory(); - LogBuffer_Printf(DE2_LOG_DEBUG, + App_Log(DE2_LOG_DEBUG, "Memory zone status: %u volumes, %u bytes allocated, %u bytes free (%f%% in use)\n", Z_VolumeCount(), (uint)allocated, (uint)wasted, (float)allocated/(float)(allocated+wasted)*100.f); } @@ -1060,7 +1060,7 @@ static void addBlockToSet(zblockset_t *set) set->_blockCount++; set->_blocks = Z_Recalloc(set->_blocks, sizeof(zblockset_block_t) * set->_blockCount, set->_tag); - LogBuffer_Printf(DE2_LOG_DEBUG, + App_Log(DE2_LOG_DEBUG, "addBlockToSet: set=%p blockCount=%u elemSize=%u elemCount=%u (total=%u)\n", set, set->_blockCount, (uint)set->_elementSize, set->_elementsPerBlock, (uint)(set->_blockCount * set->_elementSize * set->_elementsPerBlock)); diff --git a/doomsday/libdeng1/src/reader.c b/doomsday/libdeng1/src/reader.c index 9c8afa62d5..76403d4d64 100644 --- a/doomsday/libdeng1/src/reader.c +++ b/doomsday/libdeng1/src/reader.c @@ -78,7 +78,7 @@ static dd_bool Reader_Check(Reader const *reader, size_t len) } if(reader->pos > reader->size - len) { - LogBuffer_Printf(DE2_LOG_ERROR, + App_Log(DE2_LOG_ERROR, "Reader_Check: Position %lu[+%lu] out of bounds, size=%lu.\n", (unsigned long) reader->pos, (unsigned long) len, diff --git a/doomsday/libdeng1/src/stack.c b/doomsday/libdeng1/src/stack.c index 8ef03db757..53742e2353 100644 --- a/doomsday/libdeng1/src/stack.c +++ b/doomsday/libdeng1/src/stack.c @@ -75,7 +75,7 @@ void *Stack_Pop(ddstack_t *s) if(!s->height) { - LogBuffer_Printf(DE2_LOG_DEBUG, "Stack::Pop: Underflow.\n"); + App_Log(DE2_LOG_DEBUG, "Stack::Pop: Underflow.\n"); return NULL; } diff --git a/doomsday/libdeng1/src/writer.c b/doomsday/libdeng1/src/writer.c index fa3c749748..af6d691493 100644 --- a/doomsday/libdeng1/src/writer.c +++ b/doomsday/libdeng1/src/writer.c @@ -89,7 +89,7 @@ static dd_bool Writer_Check(Writer const *writer, size_t len) if((int)writer->pos <= (int)writer->size - (int)len) return true; } - LogBuffer_Printf(DE2_LOG_ERROR, + App_Log(DE2_LOG_ERROR, "Writer_Check: Position %lu[+%lu] out of bounds, size=%lu, dynamic=%i.\n", (unsigned long) writer->pos, (unsigned long) len, @@ -326,7 +326,7 @@ void Writer_WritePackedUInt16(Writer *writer, uint16_t v) { if(v & 0x8000) { - LogBuffer_Printf(DE2_LOG_ERROR, + App_Log(DE2_LOG_ERROR, "Writer_WritePackedUInt16: Cannot write %i (%x).\n", v, v); return; } diff --git a/doomsday/libdeng2/include/de/c_wrapper.h b/doomsday/libdeng2/include/de/c_wrapper.h index 9061e0c827..6dfbcbff37 100644 --- a/doomsday/libdeng2/include/de/c_wrapper.h +++ b/doomsday/libdeng2/include/de/c_wrapper.h @@ -54,6 +54,7 @@ extern "C" { */ DENG2_PUBLIC void App_Timer(unsigned int milliseconds, void (*callback)(void)); DENG2_PUBLIC void App_FatalError(char const *msg); +DENG2_PUBLIC void App_Log(unsigned int metadata, char const *format, ...); /* * CommandLine @@ -229,7 +230,6 @@ logentry_metadata_t; DENG2_PUBLIC void LogBuffer_EnableStandardOutput(int enable); DENG2_PUBLIC void LogBuffer_Flush(void); DENG2_PUBLIC void LogBuffer_Clear(void); -DENG2_PUBLIC void LogBuffer_Msg(char const *text); // note: manual newlines DENG2_PUBLIC void LogBuffer_Printf(unsigned int metadata, char const *format, ...); // note: manual newlines /* diff --git a/doomsday/libdeng2/src/c_wrapper.cpp b/doomsday/libdeng2/src/c_wrapper.cpp index eae889e2e8..83871ef521 100644 --- a/doomsday/libdeng2/src/c_wrapper.cpp +++ b/doomsday/libdeng2/src/c_wrapper.cpp @@ -33,6 +33,40 @@ #define DENG2_COMMANDLINE() DENG2_APP->commandLine() +static bool checkLogEntryMetadata(unsigned int &metadata) +{ + // Automatically apply the generic domain if not specified. + if(!(metadata & de::LogEntry::DomainMask)) + { + metadata |= de::LogEntry::Generic; + } + + // Validate the level. + de::LogEntry::Level logLevel = de::LogEntry::Level(metadata & de::LogEntry::LevelMask); + if(logLevel < de::LogEntry::XVerbose || logLevel > de::LogEntry::Critical) + { + metadata &= ~de::LogEntry::LevelMask; + metadata |= de::LogEntry::Message; + } + + // If this level is not enabled, just ignore. + return de::LogBuffer::appBuffer().isEnabled(metadata); +} + +static void logFragmentPrinter(duint32 metadata, char const *fragment) +{ + static std::string currentLogLine; + + currentLogLine += fragment; + + std::string::size_type pos; + while((pos = currentLogLine.find('\n')) != std::string::npos) + { + LOG().enter(metadata, currentLogLine.substr(0, pos).c_str()); + currentLogLine.erase(0, pos + 1); + } +} + void App_Timer(unsigned int milliseconds, void (*callback)(void)) { de::Loop::timer(de::TimeDelta::fromMilliSeconds(milliseconds), callback); @@ -43,6 +77,28 @@ void App_FatalError(char const *msg) DENG2_APP->handleUncaughtException(msg); } +void App_Log(unsigned int metadata, char const *format, ...) +{ + if(!checkLogEntryMetadata(metadata)) return; + + char buffer[0x2000]; + va_list args; + va_start(args, format); + size_t nc = vsprintf(buffer, format, args); /// @todo unsafe + va_end(args); + DENG2_ASSERT(nc < sizeof(buffer) - 2); + if(!nc) return; + + // Make sure there's a newline in the end. + if(buffer[nc - 1] != '\n') + { + buffer[nc++] = '\n'; + buffer[nc] = 0; + } + + logFragmentPrinter(metadata, buffer); +} + void CommandLine_Alias(char const *longname, char const *shortname) { DENG2_COMMANDLINE().alias(longname, shortname); @@ -129,51 +185,18 @@ void LogBuffer_EnableStandardOutput(int enable) de::LogBuffer::appBuffer().enableStandardOutput(enable != 0); } -static void logFragmentPrinter(duint32 metadata, char const *fragment) -{ - static std::string currentLogLine; - - currentLogLine += fragment; - - std::string::size_type pos; - while((pos = currentLogLine.find('\n')) != std::string::npos) - { - LOG().enter(metadata, currentLogLine.substr(0, pos).c_str()); - currentLogLine.erase(0, pos + 1); - } -} - -void LogBuffer_Msg(char const *text) -{ - logFragmentPrinter(de::LogEntry::Generic | de::LogEntry::Message, text); -} - void LogBuffer_Printf(unsigned int metadata, char const *format, ...) { - // Automatically apply the generic domain if not specified. - if(!(metadata & de::LogEntry::DomainMask)) - { - metadata |= de::LogEntry::Generic; - } - - // Validate the level. - de::LogEntry::Level logLevel = de::LogEntry::Level(metadata & de::LogEntry::LevelMask); - if(logLevel < de::LogEntry::XVerbose || logLevel > de::LogEntry::Critical) - { - metadata &= ~de::LogEntry::LevelMask; - metadata |= (logLevel = de::LogEntry::Message); - } - - // If this level is not enabled, just ignore. - if(!de::LogBuffer::appBuffer().isEnabled(metadata)) return; + if(!checkLogEntryMetadata(metadata)) return; - char buffer[2048]; + char buffer[0x2000]; va_list args; va_start(args, format); - vsprintf(buffer, format, args); /// @todo unsafe + size_t nc = vsprintf(buffer, format, args); /// @todo unsafe va_end(args); + DENG2_ASSERT(nc < sizeof(buffer) - 1); - logFragmentPrinter(logLevel | (metadata & de::LogEntry::ContextMask), buffer); + logFragmentPrinter(metadata, buffer); } Info *Info_NewFromString(char const *utf8text) diff --git a/doomsday/plugins/common/src/d_netsv.c b/doomsday/plugins/common/src/d_netsv.c index 4225043e87..64769fc34c 100644 --- a/doomsday/plugins/common/src/d_netsv.c +++ b/doomsday/plugins/common/src/d_netsv.c @@ -1618,7 +1618,7 @@ D_CMD(MapCycle) if(!IS_SERVER) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Only allowed for a server.\n"); + App_Log(DE2_LOG_SCR_ERROR, "Only allowed for a server.\n"); return false; } @@ -1628,7 +1628,7 @@ D_CMD(MapCycle) map = NetSv_ScanCycle(cycleIndex = 0, 0); if(map < 0) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "MapCycle \"%s\" is invalid.\n", mapCycle); + App_Log(DE2_LOG_SCR_ERROR, "MapCycle \"%s\" is invalid.\n", mapCycle); return false; } for(i = 0; i < MAXPLAYERS; ++i) diff --git a/doomsday/plugins/common/src/fi_lib.c b/doomsday/plugins/common/src/fi_lib.c index 24af53c937..c3ded6321d 100644 --- a/doomsday/plugins/common/src/fi_lib.c +++ b/doomsday/plugins/common/src/fi_lib.c @@ -654,7 +654,7 @@ D_CMD(StartFinale) return false; if(!Def_Get(DD_DEF_FINALE, argv[1], &fin)) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Script '%s' is not defined.\n", argv[1]); + App_Log(DE2_LOG_SCR_ERROR, "Script '%s' is not defined.\n", argv[1]); return false; } G_SetGameAction(GA_NONE); diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index b48185b06d..9f3049d7aa 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -1160,7 +1160,7 @@ static void printMapBanner(void) { const char* name = P_GetMapNiceName(); - LogBuffer_Printf(DE2_LOG_MAP, "\n"); + App_Log(DE2_LOG_MAP, ""); if(name) { char buf[64]; @@ -1169,7 +1169,7 @@ static void printMapBanner(void) #else dd_snprintf(buf, 64, "Map %u: %s", gameMap+1, name); #endif - LogBuffer_Printf(DE2_LOG_MAP, "%s\n", buf); + App_Log(DE2_LOG_MAP, "%s\n", buf); } #if !__JHEXEN__ @@ -1183,12 +1183,12 @@ static void printMapBanner(void) if(!lauthor) lauthor = unknownAuthorStr; - LogBuffer_Printf(DE2_LOG_MAP, "Author: %s\n", lauthor); + App_Log(DE2_LOG_MAP, "Author: %s\n", lauthor); Uri_Delete(uri); } #endif - LogBuffer_Printf(DE2_LOG_MAP, "\n"); + App_Log(DE2_LOG_MAP, ""); } void G_BeginMap(void) diff --git a/doomsday/plugins/common/src/p_player.c b/doomsday/plugins/common/src/p_player.c index be4ea2b72a..ac681238af 100644 --- a/doomsday/plugins/common/src/p_player.c +++ b/doomsday/plugins/common/src/p_player.c @@ -809,8 +809,7 @@ void P_SetMessage(player_t* pl, int flags, const char* msg) if(pl == &players[CONSOLEPLAYER]) { - LogBuffer_Printf(DE2_LOG_MAP | (cfg.echoMsg? DE2_LOG_NOTE : DE2_LOG_VERBOSE), - "%s\n", msg); + App_Log(DE2_LOG_MAP | (cfg.echoMsg? DE2_LOG_NOTE : DE2_LOG_VERBOSE), "%s\n", msg); } // Servers are responsible for sending these messages to the clients. @@ -838,8 +837,7 @@ void P_SetYellowMessage(player_t* pl, int flags, const char* msg) if(pl == &players[CONSOLEPLAYER]) { - LogBuffer_Printf(DE2_LOG_MAP | (cfg.echoMsg? DE2_LOG_NOTE : DE2_LOG_VERBOSE), - "%s\n", msg); + App_Log(DE2_LOG_MAP | (cfg.echoMsg? DE2_LOG_NOTE : DE2_LOG_VERBOSE), "%s\n", msg); } // Servers are responsible for sending these messages to the clients. @@ -1019,7 +1017,7 @@ D_CMD(SetCamera) p = atoi(argv[1]); if(p < 0 || p >= MAXPLAYERS) { - LogBuffer_Printf(DE2_LOG_SCR| DE2_LOG_ERROR, "Invalid console number %i\n", p); + App_Log(DE2_LOG_SCR| DE2_LOG_ERROR, "Invalid console number %i\n", p); return false; } @@ -1161,21 +1159,21 @@ D_CMD(MakeLocal) if(G_GameState() != GS_MAP) { - LogBuffer_Printf(DE2_LOG_ERROR | DE2_LOG_MAP, "You must be in a game to create a local player.\n"); + App_Log(DE2_LOG_ERROR | DE2_LOG_MAP, "You must be in a game to create a local player.\n"); return false; } p = atoi(argv[1]); if(p < 0 || p >= MAXPLAYERS) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Invalid console number %i.\n", p); + App_Log(DE2_LOG_SCR_ERROR, "Invalid console number %i.\n", p); return false; } plr = &players[p]; if(plr->plr->inGame) { - LogBuffer_Printf(DE2_LOG_ERROR | DE2_LOG_MAP, "Player %i is already in the game.\n", p); + App_Log(DE2_LOG_ERROR | DE2_LOG_MAP, "Player %i is already in the game.\n", p); return false; } @@ -1200,7 +1198,7 @@ D_CMD(PrintPlayerCoords) if(!(mo = players[CONSOLEPLAYER].plr->mo)) return false; - LogBuffer_Printf(DE2_LOG_MAP, "Console %i: X=%g Y=%g Z=%g\n", CONSOLEPLAYER, + App_Log(DE2_LOG_MAP, "Console %i: X=%g Y=%g Z=%g\n", CONSOLEPLAYER, mo->origin[VX], mo->origin[VY], mo->origin[VZ]); return true; @@ -1209,7 +1207,7 @@ D_CMD(PrintPlayerCoords) D_CMD(CycleSpy) { //// @todo The engine should do this. - LogBuffer_Printf(DE2_LOG_MAP | DE2_LOG_ERROR, "Spying not allowed.\n"); + App_Log(DE2_LOG_MAP | DE2_LOG_ERROR, "Spying not allowed.\n"); #if 0 if(G_GameState() == GS_MAP && !deathmatch) { // Cycle the display player. @@ -1237,16 +1235,16 @@ D_CMD(SpawnMobj) if(argc != 5 && argc != 6) { - LogBuffer_Printf(DE2_LOG_SCR_NOTE, "Usage: %s (type) (x) (y) (z) (angle)\n", argv[0]); - LogBuffer_Printf(DE2_LOG_SCR, "Type must be a defined Thing ID or Name.\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Z is an offset from the floor, 'floor', 'ceil' or 'random'.\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Angle (0..360) is optional.\n"); + App_Log(DE2_LOG_SCR_NOTE, "Usage: %s (type) (x) (y) (z) (angle)\n", argv[0]); + App_Log(DE2_LOG_SCR, "Type must be a defined Thing ID or Name.\n"); + App_Log(DE2_LOG_SCR, "Z is an offset from the floor, 'floor', 'ceil' or 'random'.\n"); + App_Log(DE2_LOG_SCR, "Angle (0..360) is optional.\n"); return true; } if(IS_CLIENT) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "%s can't be used by clients\n", argv[0]); + App_Log(DE2_LOG_SCR_ERROR, "%s can't be used by clients\n", argv[0]); return false; } @@ -1256,7 +1254,7 @@ D_CMD(SpawnMobj) // Try to find it by name instead. if((type = Def_Get(DD_DEF_MOBJ_BY_NAME, argv[1], 0)) < 0) { - LogBuffer_Printf(DE2_LOG_RES | DE2_LOG_ERROR, "Undefined thing type %s\n", argv[1]); + App_Log(DE2_LOG_RES | DE2_LOG_ERROR, "Undefined thing type %s\n", argv[1]); return false; } } diff --git a/doomsday/plugins/common/src/p_saveg.cpp b/doomsday/plugins/common/src/p_saveg.cpp index 91197b6dbf..b2f34c4125 100644 --- a/doomsday/plugins/common/src/p_saveg.cpp +++ b/doomsday/plugins/common/src/p_saveg.cpp @@ -2331,7 +2331,7 @@ static void readPlayers(dd_bool *infile, dd_bool *loaded) loaded[k] = true; // Later references to the player number 'i' must be translated! saveToRealPlayerNum[i] = k; - LogBuffer_Printf(DE2_LOG_DEV | DE2_LOG_MAP, "readPlayers: saved %i is now %i\n", i, k); + App_Log(DE2_LOG_DEV | DE2_LOG_MAP, "readPlayers: saved %i is now %i\n", i, k); break; } } @@ -5537,7 +5537,7 @@ static void readMapState() #if __JHEXEN__ DENG_ASSERT(path != 0); - LogBuffer_Printf(DE2_LOG_DEV | DE2_LOG_MAP, "readMapState: Opening file \"%s\"\n", Str_Text(path)); + App_Log(DE2_LOG_DEV | DE2_LOG_MAP, "readMapState: Opening file \"%s\"\n", Str_Text(path)); // Load the file size_t bufferSize = M_ReadFile(Str_Text(path), (char**)&saveBuffer); diff --git a/doomsday/plugins/common/src/p_saveio.c b/doomsday/plugins/common/src/p_saveio.c index e845ff1f59..32ec70ce77 100644 --- a/doomsday/plugins/common/src/p_saveio.c +++ b/doomsday/plugins/common/src/p_saveio.c @@ -230,7 +230,7 @@ void SV_AssertSegment(int segmentId) #if __JHEXEN__ if(segmentId == ASEG_END && SV_HxBytesLeft() < 4) { - LogBuffer_Printf(DE2_LOG_WARNING, "Savegame lacks ASEG_END marker (unexpected end-of-file)\n"); + App_Log(DE2_LOG_WARNING, "Savegame lacks ASEG_END marker (unexpected end-of-file)\n"); return; } if(SV_ReadLong() != segmentId) diff --git a/doomsday/plugins/common/src/p_start.cpp b/doomsday/plugins/common/src/p_start.cpp index 6c2aa6a082..5492841346 100644 --- a/doomsday/plugins/common/src/p_start.cpp +++ b/doomsday/plugins/common/src/p_start.cpp @@ -616,9 +616,9 @@ static void spawnPlayer(int plrNum, playerclass_t pClass, coord_t x, coord_t y, */ void P_SpawnClient(int plrNum) { - LogBuffer_Printf(DE2_LOG_VERBOSE | DE2_LOG_MAP, - "Spawning client player mobj (for player %i; console player is %i)\n", - plrNum, CONSOLEPLAYER); + App_Log(DE2_LOG_VERBOSE | DE2_LOG_MAP, + "Spawning client player mobj (for player %i; console player is %i)\n", + plrNum, CONSOLEPLAYER); // The server will fix the player's position and angles soon after. spawnPlayer(plrNum, P_ClassForPlayerWhenRespawning(plrNum, true), @@ -651,7 +651,7 @@ void P_RebornPlayerInMultiplayer(int plrNum) playerclass_t pClass = P_ClassForPlayerWhenRespawning(plrNum, false); player_t *p = &players[plrNum]; - LogBuffer_Printf(DE2_LOG_DEV | DE2_LOG_MAP, "P_RebornPlayer: player %i (class %i)\n", plrNum, pClass); + App_Log(DE2_LOG_DEV | DE2_LOG_MAP, "P_RebornPlayer: player %i (class %i)\n", plrNum, pClass); if(p->plr->mo) { @@ -662,8 +662,8 @@ void P_RebornPlayerInMultiplayer(int plrNum) if(G_GameState() != GS_MAP) { - LogBuffer_Printf(DE2_LOG_DEV | DE2_LOG_MAP | DE2_LOG_ERROR, - "P_RebornPlayer: Game state is %i, won't spawn\n", G_GameState()); + App_Log(DE2_LOG_DEV | DE2_LOG_MAP | DE2_LOG_ERROR, + "P_RebornPlayer: Game state is %i, won't spawn\n", G_GameState()); return; // Nothing else to do. } @@ -713,7 +713,7 @@ void P_RebornPlayerInMultiplayer(int plrNum) if(P_CheckSpot(spot->origin[VX], spot->origin[VY])) { // Appropriate player start spot is open. - LogBuffer_Printf(DE2_LOG_MAP | DE2_LOG_DEV, "- spawning at assigned spot\n"); + App_Log(DE2_LOG_MAP | DE2_LOG_DEV, "- spawning at assigned spot\n"); pos[VX] = spot->origin[VX]; pos[VY] = spot->origin[VY]; @@ -728,7 +728,7 @@ void P_RebornPlayerInMultiplayer(int plrNum) #if __JDOOM__ || __JHERETIC__ || __JDOOM64__ if(!foundSpot) { - LogBuffer_Printf(DE2_LOG_MAP | DE2_LOG_DEV, "- force spawning at %i\n", p->startSpot); + App_Log(DE2_LOG_MAP | DE2_LOG_DEV, "- force spawning at %i\n", p->startSpot); if(assigned) { diff --git a/doomsday/plugins/common/src/p_xgsec.c b/doomsday/plugins/common/src/p_xgsec.c index 5a6afbe92d..7164aec03c 100644 --- a/doomsday/plugins/common/src/p_xgsec.c +++ b/doomsday/plugins/common/src/p_xgsec.c @@ -3046,17 +3046,17 @@ D_CMD(MovePlane) if(argc < 2) { - LogBuffer_Printf(DE2_LOG_SCR_NOTE, "Usage: %s (opts)\n", argv[0]); - LogBuffer_Printf(DE2_LOG_SCR, "Opts can be:\n"); - LogBuffer_Printf(DE2_LOG_SCR, " here [crush] [off] (z/units) [speed]\n"); - LogBuffer_Printf(DE2_LOG_SCR, " at (x) (y) [crush] [off] (z/units) [speed]\n"); - LogBuffer_Printf(DE2_LOG_SCR, " tag (sector-tag) [crush] [off] (z/units) [speed]\n"); + App_Log(DE2_LOG_SCR_NOTE, "Usage: %s (opts)\n", argv[0]); + App_Log(DE2_LOG_SCR, "Opts can be:\n"); + App_Log(DE2_LOG_SCR, " here [crush] [off] (z/units) [speed]\n"); + App_Log(DE2_LOG_SCR, " at (x) (y) [crush] [off] (z/units) [speed]\n"); + App_Log(DE2_LOG_SCR, " tag (sector-tag) [crush] [off] (z/units) [speed]\n"); return true; } if(IS_CLIENT) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Clients can't move planes\n"); + App_Log(DE2_LOG_SCR_ERROR, "Clients can't move planes\n"); return false; } @@ -3098,7 +3098,7 @@ D_CMD(MovePlane) } else { // Unknown mode. - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown mode\n"); + App_Log(DE2_LOG_SCR_ERROR, "Unknown mode\n"); return false; } @@ -3108,7 +3108,7 @@ D_CMD(MovePlane) // No more arguments? if(argc == p) { - LogBuffer_Printf(DE2_LOG_MAP, "Ceiling = %g\nFloor = %g\n", ceilingheight, floorheight); + App_Log(DE2_LOG_MAP, "Ceiling = %g\nFloor = %g\n", ceilingheight, floorheight); return true; } @@ -3133,7 +3133,7 @@ D_CMD(MovePlane) } else { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "You must specify Z-units\n"); + App_Log(DE2_LOG_SCR_ERROR, "You must specify Z-units\n"); return false; // Required parameter missing. } diff --git a/doomsday/plugins/directsound/src/driver_directsound.cpp b/doomsday/plugins/directsound/src/driver_directsound.cpp index b0eba0455e..abc768438c 100644 --- a/doomsday/plugins/directsound/src/driver_directsound.cpp +++ b/doomsday/plugins/directsound/src/driver_directsound.cpp @@ -408,16 +408,16 @@ int DS_Init(void) { useEAX = false; - LogBuffer_Printf(DE2_LOG_DEV | DE2_LOG_AUDIO | DE2_LOG_WARNING, - "dsDirectSound::DS_Init: Failed retrieving property set.\n"); + App_Log(DE2_LOG_DEV | DE2_LOG_AUDIO | DE2_LOG_WARNING, + "dsDirectSound::DS_Init: Failed retrieving property set.\n"); } } // Announce capabilites: - LogBuffer_Printf(DE2_LOG_AUDIO, "DirectSound configuration:\n"); - LogBuffer_Printf(DE2_LOG_AUDIO, " Primary Buffer: %s (%s)\n", (primaryBuffer3D? "3D" : "2D"), - (primaryBufferHW? "hardware" : "software")); - LogBuffer_Printf(DE2_LOG_AUDIO, " Hardware Buffers: %i\n", (primaryBuffer3D? NUMBUFFERS_HW_3D : NUMBUFFERS_HW_2D)); + App_Log(DE2_LOG_AUDIO, "DirectSound configuration:\n"); + App_Log(DE2_LOG_AUDIO, " Primary Buffer: %s (%s)\n", (primaryBuffer3D? "3D" : "2D"), + (primaryBufferHW? "hardware" : "software")); + App_Log(DE2_LOG_AUDIO, " Hardware Buffers: %i\n", (primaryBuffer3D? NUMBUFFERS_HW_3D : NUMBUFFERS_HW_2D)); LogBuffer_Printf(DE2_LOG_AUDIO, " DSP: %s", eaxAvailable? "EAX 2.0" : "None"); if(eaxAvailable) LogBuffer_Printf(DE2_LOG_AUDIO, " (%s)", useEAX? "enabled" : "disabled"); @@ -425,18 +425,18 @@ int DS_Init(void) if(eaxAvailable) { - LogBuffer_Printf(DE2_LOG_AUDIO, " EAX Listner Environment:\n"); + App_Log(DE2_LOG_AUDIO, " EAX Listner Environment:\n"); for(size_t i = 0; eaxProps[i].prop != DSPROPERTY_EAXLISTENER_NONE; ++i) { const eaxproperty_t* p = &eaxProps[i]; - LogBuffer_Printf(DE2_LOG_AUDIO, " %s: %s", p->name, - queryEAXSupport(p->prop)? "Present\n" : "Not available\n"); + App_Log(DE2_LOG_AUDIO, " %s: %s", p->name, + queryEAXSupport(p->prop)? "Present\n" : "Not available\n"); } } // Success! - LogBuffer_Printf(DE2_LOG_AUDIO | DE2_LOG_VERBOSE | DE2_LOG_DEV, + App_Log(DE2_LOG_AUDIO | DE2_LOG_VERBOSE | DE2_LOG_DEV, "dsDirectSound::DS_Init: Initialization complete, OK.\n"); return true; diff --git a/doomsday/plugins/doom/src/m_cheat.c b/doomsday/plugins/doom/src/m_cheat.c index 0e3e9c793c..2f525cbc76 100644 --- a/doomsday/plugins/doom/src/m_cheat.c +++ b/doomsday/plugins/doom/src/m_cheat.c @@ -419,31 +419,31 @@ D_CMD(CheatGive) if(G_GameState() != GS_MAP) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); + App_Log(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); return true; } if(argc != 2 && argc != 3) { - LogBuffer_Printf(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); - LogBuffer_Printf(DE2_LOG_SCR, " give (stuff) (plr)\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " - "If no id; give all of type:\n"); - LogBuffer_Printf(DE2_LOG_SCR, " a - ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " b - berserk\n"); - LogBuffer_Printf(DE2_LOG_SCR, " f - the power of flight\n"); - LogBuffer_Printf(DE2_LOG_SCR, " g - light amplification visor\n"); - LogBuffer_Printf(DE2_LOG_SCR, " h - health\n"); - LogBuffer_Printf(DE2_LOG_SCR, " i - invulnerability\n"); - LogBuffer_Printf(DE2_LOG_SCR, " k - key cards/skulls\n"); - LogBuffer_Printf(DE2_LOG_SCR, " m - computer area map\n"); - LogBuffer_Printf(DE2_LOG_SCR, " p - backpack full of ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " r - armor\n"); - LogBuffer_Printf(DE2_LOG_SCR, " s - radiation shielding suit\n"); - LogBuffer_Printf(DE2_LOG_SCR, " v - invisibility\n"); - LogBuffer_Printf(DE2_LOG_SCR, " w - weapons\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give arw' corresponds the cheat IDFA.\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); + App_Log(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); + App_Log(DE2_LOG_SCR, " give (stuff) (plr)\n"); + App_Log(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " + "If no id; give all of type:\n"); + App_Log(DE2_LOG_SCR, " a - ammo\n"); + App_Log(DE2_LOG_SCR, " b - berserk\n"); + App_Log(DE2_LOG_SCR, " f - the power of flight\n"); + App_Log(DE2_LOG_SCR, " g - light amplification visor\n"); + App_Log(DE2_LOG_SCR, " h - health\n"); + App_Log(DE2_LOG_SCR, " i - invulnerability\n"); + App_Log(DE2_LOG_SCR, " k - key cards/skulls\n"); + App_Log(DE2_LOG_SCR, " m - computer area map\n"); + App_Log(DE2_LOG_SCR, " p - backpack full of ammo\n"); + App_Log(DE2_LOG_SCR, " r - armor\n"); + App_Log(DE2_LOG_SCR, " s - radiation shielding suit\n"); + App_Log(DE2_LOG_SCR, " v - invisibility\n"); + App_Log(DE2_LOG_SCR, " w - weapons\n"); + App_Log(DE2_LOG_SCR, "Example: 'give arw' corresponds the cheat IDFA.\n"); + App_Log(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); return true; } @@ -492,8 +492,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < AT_FIRST || idx >= NUM_AMMO_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", - (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", + (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); break; } @@ -539,8 +539,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < KT_FIRST || idx >= NUM_KEY_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", - (int)idx, KT_FIRST, NUM_KEY_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", + (int)idx, KT_FIRST, NUM_KEY_TYPES-1); break; } @@ -576,8 +576,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < 0 || idx >= 4) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown armor type #%d (valid range %d-%d)\n", - (int)idx, 0, 4-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown armor type #%d (valid range %d-%d)\n", + (int)idx, 0, 4-1); break; } @@ -608,8 +608,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < WT_FIRST || idx >= NUM_WEAPON_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", - (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", + (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); break; } @@ -624,7 +624,7 @@ D_CMD(CheatGive) break; default: // Unrecognized. - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); + App_Log(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); break; } } @@ -658,7 +658,7 @@ D_CMD(CheatMassacre) } else { - LogBuffer_Printf(DE2_LOG_MAP, "%i monsters killed\n", P_Massacre()); + App_Log(DE2_LOG_MAP, "%i monsters killed\n", P_Massacre()); } } return true; @@ -715,7 +715,7 @@ D_CMD(CheatLeaveMap) if(G_GameState() != GS_MAP) { S_LocalSound(SFX_OOF, NULL); - LogBuffer_Printf(DE2_LOG_MAP | DE2_LOG_ERROR, "Can only exit a map when in a game!\n"); + App_Log(DE2_LOG_MAP | DE2_LOG_ERROR, "Can only exit a map when in a game!\n"); return true; } diff --git a/doomsday/plugins/doom/src/st_stuff.c b/doomsday/plugins/doom/src/st_stuff.c index 08ddffd9bc..6ea4121dd2 100644 --- a/doomsday/plugins/doom/src/st_stuff.c +++ b/doomsday/plugins/doom/src/st_stuff.c @@ -3276,7 +3276,7 @@ void ST_ToggleAutomapMaxZoom(int player) if(!obj) return; if(UIAutomap_SetZoomMax(obj, !UIAutomap_ZoomMax(obj))) { - LogBuffer_Printf(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); + App_Log(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); } } diff --git a/doomsday/plugins/doom64/src/m_cheat.c b/doomsday/plugins/doom64/src/m_cheat.c index de5012fd36..ac5e1e80d3 100644 --- a/doomsday/plugins/doom64/src/m_cheat.c +++ b/doomsday/plugins/doom64/src/m_cheat.c @@ -407,25 +407,25 @@ D_CMD(CheatGive) if(argc != 2 && argc != 3) { - LogBuffer_Printf(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); - LogBuffer_Printf(DE2_LOG_SCR, " give (stuff) (plr)\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " - "If no id; give all of type:\n"); - LogBuffer_Printf(DE2_LOG_SCR, " a - ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " b - berserk\n"); - LogBuffer_Printf(DE2_LOG_SCR, " f - the power of flight\n"); - LogBuffer_Printf(DE2_LOG_SCR, " g - light amplification visor\n"); - LogBuffer_Printf(DE2_LOG_SCR, " h - health\n"); - LogBuffer_Printf(DE2_LOG_SCR, " i - invulnerability\n"); - LogBuffer_Printf(DE2_LOG_SCR, " k - key cards/skulls\n"); - LogBuffer_Printf(DE2_LOG_SCR, " m - computer area map\n"); - LogBuffer_Printf(DE2_LOG_SCR, " p - backpack full of ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " r - armor\n"); - LogBuffer_Printf(DE2_LOG_SCR, " s - radiation shielding suit\n"); - LogBuffer_Printf(DE2_LOG_SCR, " v - invisibility\n"); - LogBuffer_Printf(DE2_LOG_SCR, " w - weapons\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give arw' corresponds the cheat IDFA.\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); + App_Log(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); + App_Log(DE2_LOG_SCR, " give (stuff) (plr)\n"); + App_Log(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " + "If no id; give all of type:\n"); + App_Log(DE2_LOG_SCR, " a - ammo\n"); + App_Log(DE2_LOG_SCR, " b - berserk\n"); + App_Log(DE2_LOG_SCR, " f - the power of flight\n"); + App_Log(DE2_LOG_SCR, " g - light amplification visor\n"); + App_Log(DE2_LOG_SCR, " h - health\n"); + App_Log(DE2_LOG_SCR, " i - invulnerability\n"); + App_Log(DE2_LOG_SCR, " k - key cards/skulls\n"); + App_Log(DE2_LOG_SCR, " m - computer area map\n"); + App_Log(DE2_LOG_SCR, " p - backpack full of ammo\n"); + App_Log(DE2_LOG_SCR, " r - armor\n"); + App_Log(DE2_LOG_SCR, " s - radiation shielding suit\n"); + App_Log(DE2_LOG_SCR, " v - invisibility\n"); + App_Log(DE2_LOG_SCR, " w - weapons\n"); + App_Log(DE2_LOG_SCR, "Example: 'give arw' corresponds the cheat IDFA.\n"); + App_Log(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); return true; } @@ -438,7 +438,7 @@ D_CMD(CheatGive) if(G_GameState() != GS_MAP) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); + App_Log(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); return true; } @@ -465,8 +465,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < AT_FIRST || idx >= NUM_AMMO_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", - (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", + (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); break; } @@ -521,8 +521,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < KT_FIRST || idx >= NUM_KEY_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", - (int)idx, KT_FIRST, NUM_KEY_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", + (int)idx, KT_FIRST, NUM_KEY_TYPES-1); break; } @@ -575,8 +575,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < WT_FIRST || idx >= NUM_WEAPON_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", - (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", + (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); break; } @@ -591,7 +591,7 @@ D_CMD(CheatGive) break; default: // Unrecognized. - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); + App_Log(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); break; } } @@ -601,7 +601,7 @@ D_CMD(CheatGive) D_CMD(CheatMassacre) { - LogBuffer_Printf(DE2_LOG_MAP, "%i monsters killed\n", P_Massacre()); + App_Log(DE2_LOG_MAP, "%i monsters killed\n", P_Massacre()); return true; } @@ -622,7 +622,7 @@ D_CMD(CheatLeaveMap) if(G_GameState() != GS_MAP) { S_LocalSound(SFX_OOF, NULL); - LogBuffer_Printf(DE2_LOG_ERROR | DE2_LOG_MAP, "Can only exit a map when in a game!\n"); + App_Log(DE2_LOG_ERROR | DE2_LOG_MAP, "Can only exit a map when in a game!\n"); return true; } diff --git a/doomsday/plugins/doom64/src/p_spec.c b/doomsday/plugins/doom64/src/p_spec.c index 4579977331..afb3f6cd6f 100644 --- a/doomsday/plugins/doom64/src/p_spec.c +++ b/doomsday/plugins/doom64/src/p_spec.c @@ -227,15 +227,15 @@ void P_InitPicAnims(void) * Support for this extension should be considered depreciated. * All new features should be added, accessed via DED. */ - LogBuffer_Printf(DE2_LOG_RES | DE2_LOG_VERBOSE, - "Processing lump %s:ANIMATED...", - F_PrettyPath(Str_Text(W_LumpSourceFile(lumpNum)))); + App_Log(DE2_LOG_RES | DE2_LOG_VERBOSE, + "Processing lump %s:ANIMATED...", + F_PrettyPath(Str_Text(W_LumpSourceFile(lumpNum)))); loadAnimDefs((animdef_t*)W_CacheLump(lumpNum), true); W_UnlockLump(lumpNum); return; }} - LogBuffer_Printf(DE2_LOG_RES | DE2_LOG_VERBOSE, "Registering default texture animations..."); + App_Log(DE2_LOG_RES | DE2_LOG_VERBOSE, "Registering default texture animations..."); loadAnimDefs(animsShared, false); } diff --git a/doomsday/plugins/doom64/src/st_stuff.c b/doomsday/plugins/doom64/src/st_stuff.c index a2b09c7797..ce1d0ab83b 100644 --- a/doomsday/plugins/doom64/src/st_stuff.c +++ b/doomsday/plugins/doom64/src/st_stuff.c @@ -1040,7 +1040,7 @@ void ST_ToggleAutomapMaxZoom(int player) if(!obj) return; if(UIAutomap_SetZoomMax(obj, !UIAutomap_ZoomMax(obj))) { - LogBuffer_Printf(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); + App_Log(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); } } diff --git a/doomsday/plugins/example/src/example.c b/doomsday/plugins/example/src/example.c index f49e6afebe..a5ef882c10 100644 --- a/doomsday/plugins/example/src/example.c +++ b/doomsday/plugins/example/src/example.c @@ -46,7 +46,7 @@ static int ExampleHook(int hookType, int parm, void *data) DENG_UNUSED(parm); DENG_UNUSED(data); - LogBuffer_Printf(DE2_LOG_DEV, "ExampleHook: Hook successful!\n"); + App_Log(DE2_LOG_DEV, "ExampleHook: Hook successful!"); return true; } diff --git a/doomsday/plugins/fluidsynth/src/fluidsynth_music.cpp b/doomsday/plugins/fluidsynth/src/fluidsynth_music.cpp index d585c3c8f7..715300a44b 100644 --- a/doomsday/plugins/fluidsynth/src/fluidsynth_music.cpp +++ b/doomsday/plugins/fluidsynth/src/fluidsynth_music.cpp @@ -364,13 +364,11 @@ void DMFluid_SetSoundFont(const char* fileName) sfontId = fluid_synth_sfload(DMFluid_Synth(), fileName, true); if(sfontId >= 0) { - LogBuffer_Printf(DE2_LOG_VERBOSE, - "FluidSynth: Loaded SF2 soundfont \"%s\" with id:%i\n", fileName, sfontId); + App_Log(DE2_LOG_VERBOSE, "FluidSynth: Loaded SF2 soundfont \"%s\" with id:%i\n", fileName, sfontId); } else { - LogBuffer_Printf(DE2_LOG_VERBOSE, - "FluidSynth: Failed to load soundfont \"%s\" (not SF2 or not found)\n", fileName); + App_Log(DE2_LOG_VERBOSE, "FluidSynth: Failed to load soundfont \"%s\" (not SF2 or not found)\n", fileName); } } @@ -463,15 +461,13 @@ int DM_Music_PlayFile(const char *filename, int looped) if(!fluid_is_midifile(filename)) { // It doesn't look like MIDI. - LogBuffer_Printf(DE2_LOG_VERBOSE, - "FluidSynth: Cannot play \"%s\": not a MIDI file.\n", filename); + App_Log(DE2_LOG_VERBOSE, "[FluidSynth] Cannot play \"%s\": not a MIDI file", filename); return false; } if(sfontId < 0) { - LogBuffer_Printf(DE2_LOG_VERBOSE, - "FluidSynth: Cannot play \"%s\" without an SF2 soundfont.\n", filename); + App_Log(DE2_LOG_VERBOSE, "[FluidSynth] Cannot play \"%s\" without an SF2 soundfont", filename); return false; } diff --git a/doomsday/plugins/heretic/src/m_cheat.c b/doomsday/plugins/heretic/src/m_cheat.c index e93e0c0647..3736f43b48 100644 --- a/doomsday/plugins/heretic/src/m_cheat.c +++ b/doomsday/plugins/heretic/src/m_cheat.c @@ -391,26 +391,26 @@ D_CMD(CheatGive) if(G_GameState() != GS_MAP) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); + App_Log(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); return true; } if(argc != 2 && argc != 3) { - LogBuffer_Printf(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); - LogBuffer_Printf(DE2_LOG_SCR, " give (stuff) (plr)\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " - "If no id; give all of type:\n"); - LogBuffer_Printf(DE2_LOG_SCR, " a - ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " i - items\n"); - LogBuffer_Printf(DE2_LOG_SCR, " h - health\n"); - LogBuffer_Printf(DE2_LOG_SCR, " k - keys\n"); - LogBuffer_Printf(DE2_LOG_SCR, " p - backpack full of ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " r - armor\n"); - LogBuffer_Printf(DE2_LOG_SCR, " t - tome of power\n"); - LogBuffer_Printf(DE2_LOG_SCR, " w - weapons\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give ikw' gives items, keys and weapons.\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); + App_Log(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); + App_Log(DE2_LOG_SCR, " give (stuff) (plr)\n"); + App_Log(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " + "If no id; give all of type:\n"); + App_Log(DE2_LOG_SCR, " a - ammo\n"); + App_Log(DE2_LOG_SCR, " i - items\n"); + App_Log(DE2_LOG_SCR, " h - health\n"); + App_Log(DE2_LOG_SCR, " k - keys\n"); + App_Log(DE2_LOG_SCR, " p - backpack full of ammo\n"); + App_Log(DE2_LOG_SCR, " r - armor\n"); + App_Log(DE2_LOG_SCR, " t - tome of power\n"); + App_Log(DE2_LOG_SCR, " w - weapons\n"); + App_Log(DE2_LOG_SCR, "Example: 'give ikw' gives items, keys and weapons.\n"); + App_Log(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); return true; } @@ -459,7 +459,7 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < AT_FIRST || idx >= NUM_AMMO_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", + App_Log(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); break; } @@ -486,7 +486,7 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < IIT_FIRST || idx >= NUM_INVENTORYITEM_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown item #%d (valid range %d-%d)\n", + App_Log(DE2_LOG_SCR_ERROR, "Unknown item #%d (valid range %d-%d)\n", (int)idx, IIT_FIRST, NUM_INVENTORYITEM_TYPES-1); break; } @@ -536,7 +536,7 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < KT_FIRST || idx >= NUM_KEY_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", + App_Log(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", (int)idx, KT_FIRST, NUM_KEY_TYPES-1); break; } @@ -571,7 +571,7 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < 0 || idx >= 3) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown armor type #%d (valid range %d-%d)\n", + App_Log(DE2_LOG_SCR_ERROR, "Unknown armor type #%d (valid range %d-%d)\n", (int)idx, 0, 3-1); break; } @@ -610,7 +610,7 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < WT_FIRST || idx >= NUM_WEAPON_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", + App_Log(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); break; } @@ -626,7 +626,7 @@ D_CMD(CheatGive) break; default: // Unrecognized. - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); + App_Log(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); break; } } @@ -716,7 +716,7 @@ D_CMD(CheatLeaveMap) if(G_GameState() != GS_MAP) { S_LocalSound(SFX_CHAT, NULL); - LogBuffer_Printf(DE2_LOG_MAP | DE2_LOG_ERROR, "Can only exit a map when in a game!\n"); + App_Log(DE2_LOG_MAP | DE2_LOG_ERROR, "Can only exit a map when in a game!\n"); return true; } diff --git a/doomsday/plugins/heretic/src/st_stuff.c b/doomsday/plugins/heretic/src/st_stuff.c index f8c7e0dc09..6bacd0a25f 100644 --- a/doomsday/plugins/heretic/src/st_stuff.c +++ b/doomsday/plugins/heretic/src/st_stuff.c @@ -3087,7 +3087,7 @@ void ST_ToggleAutomapMaxZoom(int player) if(!obj) return; if(UIAutomap_SetZoomMax(obj, !UIAutomap_ZoomMax(obj))) { - LogBuffer_Printf(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); + App_Log(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); } } diff --git a/doomsday/plugins/hexen/src/m_cheat.c b/doomsday/plugins/hexen/src/m_cheat.c index 3971607c7b..f30aa02226 100644 --- a/doomsday/plugins/hexen/src/m_cheat.c +++ b/doomsday/plugins/hexen/src/m_cheat.c @@ -427,25 +427,25 @@ D_CMD(CheatGive) if(G_GameState() != GS_MAP) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); + App_Log(DE2_LOG_SCR_ERROR, "Can only \"give\" when in a game!\n"); return true; } if(argc != 2 && argc != 3) { - LogBuffer_Printf(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); - LogBuffer_Printf(DE2_LOG_SCR, " give (stuff) (plr)\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " - "If no id; give all of type:\n"); - LogBuffer_Printf(DE2_LOG_SCR, " a - ammo\n"); - LogBuffer_Printf(DE2_LOG_SCR, " h - health\n"); - LogBuffer_Printf(DE2_LOG_SCR, " i - items\n"); - LogBuffer_Printf(DE2_LOG_SCR, " k - keys\n"); - LogBuffer_Printf(DE2_LOG_SCR, " p - puzzle\n"); - LogBuffer_Printf(DE2_LOG_SCR, " r - armor\n"); - LogBuffer_Printf(DE2_LOG_SCR, " w - weapons\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give ikw' gives items, keys and weapons.\n"); - LogBuffer_Printf(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); + App_Log(DE2_LOG_SCR_NOTE, "Usage:\n give (stuff)\n"); + App_Log(DE2_LOG_SCR, " give (stuff) (plr)\n"); + App_Log(DE2_LOG_SCR, "Stuff consists of one or more of (type:id). " + "If no id; give all of type:\n"); + App_Log(DE2_LOG_SCR, " a - ammo\n"); + App_Log(DE2_LOG_SCR, " h - health\n"); + App_Log(DE2_LOG_SCR, " i - items\n"); + App_Log(DE2_LOG_SCR, " k - keys\n"); + App_Log(DE2_LOG_SCR, " p - puzzle\n"); + App_Log(DE2_LOG_SCR, " r - armor\n"); + App_Log(DE2_LOG_SCR, " w - weapons\n"); + App_Log(DE2_LOG_SCR, "Example: 'give ikw' gives items, keys and weapons.\n"); + App_Log(DE2_LOG_SCR, "Example: 'give w2k1' gives weapon two and key one.\n"); return true; } @@ -494,8 +494,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < AT_FIRST || idx >= NUM_AMMO_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", - (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown ammo #%d (valid range %d-%d)\n", + (int)idx, AT_FIRST, NUM_AMMO_TYPES-1); break; } @@ -540,8 +540,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < KT_FIRST || idx >= NUM_KEY_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", - (int)idx, KT_FIRST, NUM_KEY_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown key #%d (valid range %d-%d)\n", + (int)idx, KT_FIRST, NUM_KEY_TYPES-1); break; } @@ -581,8 +581,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < ARMOR_FIRST || idx >= NUMARMOR) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown armor #%d (valid range %d-%d)\n", - (int)idx, ARMOR_FIRST, NUMARMOR-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown armor #%d (valid range %d-%d)\n", + (int)idx, ARMOR_FIRST, NUMARMOR-1); break; } @@ -609,8 +609,8 @@ D_CMD(CheatGive) i += end - &buf[i+1]; if(idx < WT_FIRST || idx >= NUM_WEAPON_TYPES) { - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", - (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); + App_Log(DE2_LOG_SCR_ERROR, "Unknown weapon #%d (valid range %d-%d)\n", + (int)idx, WT_FIRST, NUM_WEAPON_TYPES-1); break; } @@ -625,7 +625,7 @@ D_CMD(CheatGive) break; default: // Unrecognized. - LogBuffer_Printf(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); + App_Log(DE2_LOG_SCR_ERROR, "Cannot give '%c': unknown letter\n", buf[i]); break; } } diff --git a/doomsday/plugins/hexen/src/st_stuff.c b/doomsday/plugins/hexen/src/st_stuff.c index 5aafbf1c33..a917bb1f56 100644 --- a/doomsday/plugins/hexen/src/st_stuff.c +++ b/doomsday/plugins/hexen/src/st_stuff.c @@ -3351,7 +3351,7 @@ void ST_ToggleAutomapMaxZoom(int player) if(!obj) return; if(UIAutomap_SetZoomMax(obj, !UIAutomap_ZoomMax(obj))) { - LogBuffer_Printf(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); + App_Log(0, "Maximum zoom %s in automap\n", UIAutomap_ZoomMax(obj)? "ON":"OFF"); } }