Skip to content

Commit

Permalink
Remove redundant log constant prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TimePath authored and Kangz committed Feb 6, 2016
1 parent c8b32c0 commit 09999e6
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion daemon/cmake/DaemonFlags.cmake
Expand Up @@ -331,5 +331,5 @@ endif()

# Configuration specific definitions
if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
add_definitions(-DDEBUG)
add_definitions(-DDEBUG_BUILD)
endif()
2 changes: 1 addition & 1 deletion daemon/src/common/Assert.h
Expand Up @@ -61,7 +61,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// DAEMON_ASSERT_CALLSITE_HELPER generates the actual assert code. In Debug it does what you would
// expect of an assert and in release it tries to give hints to make the compiler generate better code.
#if defined(DEBUG)
#if defined(DEBUG_BUILD)
#define DAEMON_ASSERT_CALLSITE_HELPER(file, func, line, _0, code, condition, message) \
do { \
code; \
Expand Down
2 changes: 1 addition & 1 deletion daemon/src/common/FileSystem.cpp
Expand Up @@ -58,7 +58,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <mach-o/dyld.h>
#endif

Log::Logger fsLogs(VM_STRING_PREFIX "fs", "[FS]", Log::Level::LOG_NOTICE);
Log::Logger fsLogs(VM_STRING_PREFIX "fs", "[FS]", Log::Level::NOTICE);

// SerializeTraits for PakInfo/LoadedPakInfo
namespace Util {
Expand Down
16 changes: 8 additions & 8 deletions daemon/src/common/Log.cpp
Expand Up @@ -46,22 +46,22 @@ namespace Log {

bool ParseCvarValue(std::string value, Log::Level& result) {
if (value == "warning" or value == "warn") {
result = Log::Level::LOG_WARNING;
result = Log::Level::WARNING;
return true;
}

if (value == "info" or value == "notice") {
result = Log::Level::LOG_NOTICE;
result = Log::Level::NOTICE;
return true;
}

if (value == "verbose") {
result = Log::Level::LOG_VERBOSE;
result = Log::Level::VERBOSE;
return true;
}

if (value == "debug" or value == "all") {
result = Log::Level::LOG_DEBUG;
result = Log::Level::DEBUG;
return true;
}

Expand All @@ -70,13 +70,13 @@ namespace Log {

std::string SerializeCvarValue(Log::Level value) {
switch(value) {
case Log::Level::LOG_WARNING:
case Log::Level::WARNING:
return "warning";
case Log::Level::LOG_NOTICE:
case Log::Level::NOTICE:
return "notice";
case Log::Level::LOG_VERBOSE:
case Log::Level::VERBOSE:
return "verbose";
case Log::Level::LOG_DEBUG:
case Log::Level::DEBUG:
return "debug";
default:
return "";
Expand Down
26 changes: 13 additions & 13 deletions daemon/src/common/Log.h
Expand Up @@ -42,14 +42,14 @@ namespace Log {
*/

enum class Level {
LOG_DEBUG,
LOG_VERBOSE,
LOG_NOTICE,
LOG_WARNING,
DEBUG,
VERBOSE,
NOTICE,
WARNING,
};

// The default filtering level
const Level DEFAULT_FILTER_LEVEL = Level::LOG_WARNING;
const Level DEFAULT_FILTER_LEVEL = Level::WARNING;

/*
* Loggers are used to group logs by subsystems and allow logs
Expand Down Expand Up @@ -179,56 +179,56 @@ namespace Log {

template<typename ... Args>
void Logger::Warn(Str::StringRef format, Args&& ... args) {
if (filterLevel.Get() <= Level::LOG_WARNING) {
if (filterLevel.Get() <= Level::WARNING) {
CodeSourceWarn(Prefix(Str::Format(format, std::forward<Args>(args) ...)));
}
}

template<typename ... Args>
void Logger::Notice(Str::StringRef format, Args&& ... args) {
if (filterLevel.Get() <= Level::LOG_NOTICE) {
if (filterLevel.Get() <= Level::NOTICE) {
CodeSourceNotice(Prefix(Str::Format(format, std::forward<Args>(args) ...)));
}
}

template<typename ... Args>
void Logger::Verbose(Str::StringRef format, Args&& ... args) {
if (filterLevel.Get() <= Level::LOG_VERBOSE) {
if (filterLevel.Get() <= Level::VERBOSE) {
CodeSourceVerbose(Prefix(Str::Format(format, std::forward<Args>(args) ...)));
}
}

template<typename ... Args>
void Logger::Debug(Str::StringRef format, Args&& ... args) {
if (filterLevel.Get() <= Level::LOG_DEBUG) {
if (filterLevel.Get() <= Level::DEBUG) {
CodeSourceDebug(Prefix(Str::Format(format, std::forward<Args>(args) ...)));
}
}

template<typename F>
inline void Logger::DoWarnCode(F&& code) {
if (filterLevel.Get() <= Level::LOG_WARNING) {
if (filterLevel.Get() <= Level::WARNING) {
code();
}
}

template<typename F>
inline void Logger::DoNoticeCode(F&& code) {
if (filterLevel.Get() <= Level::LOG_NOTICE) {
if (filterLevel.Get() <= Level::NOTICE) {
code();
}
}

template<typename F>
inline void Logger::DoVerboseCode(F&& code) {
if (filterLevel.Get() <= Level::LOG_VERBOSE) {
if (filterLevel.Get() <= Level::VERBOSE) {
code();
}
}

template<typename F>
inline void Logger::DoDebugCode(F&& code) {
if (filterLevel.Get() <= Level::LOG_DEBUG) {
if (filterLevel.Get() <= Level::DEBUG) {
code();
}
}
Expand Down
22 changes: 11 additions & 11 deletions daemon/src/engine/botlib/bot_load.cpp
Expand Up @@ -169,13 +169,13 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( !f )
{
Com_Log(log_level_t::LOG_ERROR, "Cannot open Navigaton Mesh file" );
Com_Log(log_level_t::ERROR, "Cannot open Navigaton Mesh file" );
return false;
}

if ( len < 0 )
{
Com_Log(log_level_t::LOG_ERROR, "Negative Length for Navigation Mesh file");
Com_Log(log_level_t::ERROR, "Negative Length for Navigation Mesh file");
return false;
}

Expand All @@ -187,14 +187,14 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( header.magic != NAVMESHSET_MAGIC )
{
Com_Log(log_level_t::LOG_ERROR, "File is wrong magic" );
Com_Log(log_level_t::ERROR, "File is wrong magic" );
FS_FCloseFile( f );
return false;
}

if ( header.version != NAVMESHSET_VERSION )
{
Com_Logf(log_level_t::LOG_ERROR, "File is wrong version found: %d want: %d", header.version, NAVMESHSET_VERSION );
Com_Logf(log_level_t::ERROR, "File is wrong version found: %d want: %d", header.version, NAVMESHSET_VERSION );
FS_FCloseFile( f );
return false;
}
Expand All @@ -203,7 +203,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( !nav.mesh )
{
Com_Log(log_level_t::LOG_ERROR, "Unable to allocate nav mesh" );
Com_Log(log_level_t::ERROR, "Unable to allocate nav mesh" );
FS_FCloseFile( f );
return false;
}
Expand All @@ -212,7 +212,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( dtStatusFailed( status ) )
{
Com_Log(log_level_t::LOG_ERROR, "Could not init navmesh" );
Com_Log(log_level_t::ERROR, "Could not init navmesh" );
dtFreeNavMesh( nav.mesh );
nav.mesh = nullptr;
FS_FCloseFile( f );
Expand All @@ -223,7 +223,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( !nav.cache )
{
Com_Log(log_level_t::LOG_ERROR, "Could not allocate tile cache" );
Com_Log(log_level_t::ERROR, "Could not allocate tile cache" );
dtFreeNavMesh( nav.mesh );
nav.mesh = nullptr;
FS_FCloseFile( f );
Expand All @@ -234,7 +234,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( dtStatusFailed( status ) )
{
Com_Log(log_level_t::LOG_ERROR, "Could not init tile cache" );
Com_Log(log_level_t::ERROR, "Could not init tile cache" );
dtFreeNavMesh( nav.mesh );
dtFreeTileCache( nav.cache );
nav.mesh = nullptr;
Expand All @@ -253,7 +253,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( !tileHeader.tileRef || !tileHeader.dataSize )
{
Com_Log(log_level_t::LOG_ERROR, "NUll Tile in navmesh" );
Com_Log(log_level_t::ERROR, "NUll Tile in navmesh" );
dtFreeNavMesh( nav.mesh );
dtFreeTileCache( nav.cache );
nav.cache = nullptr;
Expand All @@ -266,7 +266,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( !data )
{
Com_Log(log_level_t::LOG_ERROR, "Failed to allocate memory for tile data" );
Com_Log(log_level_t::ERROR, "Failed to allocate memory for tile data" );
dtFreeNavMesh( nav.mesh );
dtFreeTileCache( nav.cache );
nav.cache = nullptr;
Expand All @@ -289,7 +289,7 @@ bool BotLoadNavMesh( const char *filename, NavData_t &nav )

if ( dtStatusFailed( status ) )
{
Com_Log(log_level_t::LOG_ERROR, "Failed to add tile to navmesh" );
Com_Log(log_level_t::ERROR, "Failed to add tile to navmesh" );
dtFree( data );
dtFreeTileCache( nav.cache );
dtFreeNavMesh( nav.mesh );
Expand Down
2 changes: 1 addition & 1 deletion daemon/src/engine/botlib/bot_local.cpp
Expand Up @@ -82,7 +82,7 @@ void FindWaypoints( Bot_t *bot, float *corners, unsigned char *cornerFlags, dtPo
{
if ( !bot->corridor.getPathCount() )
{
Com_Log(log_level_t::LOG_ERROR, "FindWaypoints Called without a path!" );
Com_Log(log_level_t::ERROR, "FindWaypoints Called without a path!" );
*numCorners = 0;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/src/engine/client/cl_avi.cpp
Expand Up @@ -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::LOG_ERROR, "cl_aviFrameRate must be ≥ 1\n" );
Com_Log(log_level_t::ERROR, "cl_aviFrameRate must be ≥ 1\n" );
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion daemon/src/engine/client/cl_cgame.cpp
Expand Up @@ -606,7 +606,7 @@ static int LAN_ServerIsVisible( int source, int n )

if ( Cmd_Argc() == 1 )
{
Com_Log(log_level_t::LOG_ERROR, "Server sent a pubkey_decrypt command, but sent nothing to decrypt!" );
Com_Log(log_level_t::ERROR, "Server sent a pubkey_decrypt command, but sent nothing to decrypt!" );
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion daemon/src/engine/client/cl_console.cpp
Expand Up @@ -166,7 +166,7 @@ void Con_Dump_f()

if ( !f )
{
Com_Log(log_level_t::LOG_ERROR, "couldn't open." );
Com_Log(log_level_t::ERROR, "couldn't open." );
return;
}

Expand Down
18 changes: 9 additions & 9 deletions daemon/src/engine/client/cl_main.cpp
Expand Up @@ -354,21 +354,21 @@ void CL_Record_f()

if ( clc.demorecording )
{
Com_Log( log_level_t::LOG_ERROR, "Already recording." );
Com_Log(log_level_t::ERROR, "Already recording." );
return;
}

if ( cls.state != connstate_t::CA_ACTIVE )
{
Com_Log( log_level_t::LOG_ERROR, "You must be in a level to record." );
Com_Log(log_level_t::ERROR, "You must be in a level to record." );
return;
}

// ATVI Wolfenstein Misc #479 - changing this to a warning
// sync 0 doesn't prevent recording, so not forcing it off .. everyone does g_sync 1 ; record ; g_sync 0 ..
if ( NET_IsLocalAddress( clc.serverAddress ) && !Cvar_VariableValue( "g_synchronousClients" ) )
{
Com_Logf( log_level_t::LOG_WARN, "You should set '%s' for smoother demo recording" , "g_synchronousClients 1" );
Com_Logf(log_level_t::WARN, "You should set '%s' for smoother demo recording" , "g_synchronousClients 1" );
}

if ( Cmd_Argc() == 2 )
Expand Down Expand Up @@ -435,7 +435,7 @@ void CL_Record( const char *name )

if ( !clc.demofile )
{
Com_Log( log_level_t::LOG_ERROR, "couldn't open." );
Com_Log(log_level_t::ERROR, "couldn't open." );
return;
}

Expand Down Expand Up @@ -754,7 +754,7 @@ void CL_WriteWaveOpen()

if ( !clc.wavefile )
{
Com_Logf( log_level_t::LOG_ERROR, "couldn't open %s for writing.", name );
Com_Logf(log_level_t::ERROR, "couldn't open %s for writing.", name );
return;
}

Expand Down Expand Up @@ -1334,7 +1334,7 @@ void CL_Connect_f()
}
else
{
Com_Log(log_level_t::LOG_WARN, "only -4 or -6 as address type understood." );
Com_Log(log_level_t::WARN, "only -4 or -6 as address type understood." );
}

server = (char *) Cmd_Argv( 2 );
Expand Down Expand Up @@ -1819,7 +1819,7 @@ void CL_Video_f()

if ( i > 9999 )
{
Com_Log(log_level_t::LOG_ERROR, "no free file names to create video" );
Com_Log(log_level_t::ERROR, "no free file names to create video" );
return;
}
}
Expand Down Expand Up @@ -2969,12 +2969,12 @@ bool CL_WWWBadChecksum( const char *pakname )
{
if ( strstr( clc.redirectedList, va( "@%s@", pakname ) ) )
{
Com_Logf(log_level_t::LOG_WARN, "file %s obtained through download redirect has wrong checksum\n"
Com_Logf(log_level_t::WARN, "file %s obtained through download redirect has wrong checksum\n"
"\tthis likely means the server configuration is broken", pakname );

if ( strlen( clc.badChecksumList ) + strlen( pakname ) + 1 >= sizeof( clc.badChecksumList ) )
{
Com_Logf( log_level_t::LOG_ERROR, "badChecksumList overflowed (%s)", clc.badChecksumList );
Com_Logf(log_level_t::ERROR, "badChecksumList overflowed (%s)", clc.badChecksumList );
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion daemon/src/engine/framework/CrashDump.cpp
Expand Up @@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#endif // USE_BREAKPAD

Log::Logger crashDumpLogs("common.breakpad", "", Log::Level::LOG_NOTICE);
Log::Logger crashDumpLogs("common.breakpad", "", Log::Level::NOTICE);

namespace Sys {

Expand Down

0 comments on commit 09999e6

Please sign in to comment.