mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
add a log level flag
This commit is contained in:
parent
2be720540f
commit
86131bf05e
4 changed files with 21 additions and 1 deletions
|
@ -757,6 +757,7 @@ bool DivEngine::init() {
|
|||
dispatch=new DivPlatformPCE;
|
||||
break;
|
||||
default:
|
||||
logW("this system is not supported yet! using dummy platform.\n");
|
||||
dispatch=new DivPlatformDummy;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "ta-log.h"
|
||||
|
||||
int logLevel=LOGLEVEL_INFO;
|
||||
|
||||
int logD(const char* format, ...) {
|
||||
va_list va;
|
||||
int ret;
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -54,6 +54,22 @@ bool pView(String val) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool pLogLevel(String val) {
|
||||
if (val=="debug") {
|
||||
logLevel=LOGLEVEL_DEBUG;
|
||||
} else if (val=="info") {
|
||||
logLevel=LOGLEVEL_INFO;
|
||||
} else if (val=="warning") {
|
||||
logLevel=LOGLEVEL_WARN;
|
||||
} else if (val=="error") {
|
||||
logLevel=LOGLEVEL_ERROR;
|
||||
} else {
|
||||
logE("invalid value for loglevel! valid values are: debug, info, warning, error.\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pVersion(String) {
|
||||
printf("Furnace version " DIV_VERSION ".\n\n");
|
||||
printf("developed by tildearrow. copyright (C) 2021.\n");
|
||||
|
@ -95,6 +111,7 @@ void initParams() {
|
|||
params.push_back(TAParam("h","help",false,pHelp,"","display this help"));
|
||||
|
||||
params.push_back(TAParam("a","audio",true,pAudio,"jack|sdl","set audio engine (SDL by default)"));
|
||||
params.push_back(TAParam("L","loglevel",true,pLogLevel,"debug|info|warning|error","set the log level (info by default)"));
|
||||
params.push_back(TAParam("v","view",true,pView,"pattern|commands|nothing","set visualization (pattern by default)"));
|
||||
|
||||
params.push_back(TAParam("V","version",false,pVersion,"","view information about Furnace."));
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define LOGLEVEL_INFO 2
|
||||
#define LOGLEVEL_DEBUG 3
|
||||
|
||||
#define logLevel 3
|
||||
extern int logLevel;
|
||||
|
||||
int logD(const char* format, ...);
|
||||
int logI(const char* format, ...);
|
||||
|
|
Loading…
Reference in a new issue