Permalink
Browse files

Remove redundant log constant prefixes

  • Loading branch information...
1 parent c8b32c0 commit 09999e6405dd233ac7d968f0a53ceb49cb87c8e2 @TimePath TimePath committed with Kangz Jan 20, 2016
@@ -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()
@@ -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; \
@@ -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 {
@@ -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;
}
@@ -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 "";
@@ -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
@@ -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();
}
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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 );
@@ -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 );
@@ -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;
@@ -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;
@@ -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;
@@ -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 );
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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 )
@@ -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;
}
@@ -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;
}
@@ -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 );
@@ -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;
}
}
@@ -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;
}
@@ -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 {
Oops, something went wrong.

0 comments on commit 09999e6

Please sign in to comment.