Skip to content

Commit

Permalink
updated logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-nv committed Jun 16, 2020
1 parent 6dfd70b commit d952e05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 7 additions & 2 deletions logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ void Log::ParseCmdLine( const commandLine& cmdLine )
}
else
{
if( cmdLine.GetFlag("debug") )
SetLevel(DEBUG);
if( cmdLine.GetFlag("verbose") )
SetLevel(VERBOSE);

if( cmdLine.GetFlag("debug") )
SetLevel(DEBUG);
}

SetFile(cmdLine.GetString("log-file"));
Expand Down Expand Up @@ -108,6 +109,7 @@ const char* Log::LevelToStr( Log::Level level )
{
switch(level)
{
case SILENT: return "silent";
case ERROR: return "error";
case WARNING: return "warning";
case SUCCESS: return "success";
Expand All @@ -134,6 +136,9 @@ Log::Level Log::LevelFromStr( const char* str )
return level;
}

if( strcasecmp(str, "disable") == 0 || strcasecmp(str, "disabled") == 0 || strcasecmp(str, "none") == 0 )
return SILENT;

return DEFAULT;
}

Expand Down
7 changes: 3 additions & 4 deletions logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class Log
*/
enum Level
{
ERROR = 0,
SILENT = 0,
ERROR,
WARNING,
SUCCESS,
INFO,
Expand Down Expand Up @@ -110,9 +111,7 @@ class Log
* @ingroup log
* @internal
*/
#define LogMessage(level, format, args...) \
if( level <= Log::GetLevel() ) \
fprintf(Log::GetFile(), format, ## args) \
#define LogMessage(level, format, args...) if( level <= Log::GetLevel() ) fprintf(Log::GetFile(), format, ## args)

/**
* @ingroup log
Expand Down

0 comments on commit d952e05

Please sign in to comment.