add a new log level (trace)
This commit is contained in:
parent
711b60d454
commit
47d7722f6e
|
@ -190,6 +190,7 @@ class DivEngine {
|
||||||
bool forceMono;
|
bool forceMono;
|
||||||
bool cmdStreamEnabled;
|
bool cmdStreamEnabled;
|
||||||
bool softLocked;
|
bool softLocked;
|
||||||
|
int softLockCount;
|
||||||
int ticks, curRow, curOrder, remainingLoops, nextSpeed;
|
int ticks, curRow, curOrder, remainingLoops, nextSpeed;
|
||||||
double divider;
|
double divider;
|
||||||
int cycles;
|
int cycles;
|
||||||
|
@ -681,6 +682,8 @@ class DivEngine {
|
||||||
halted(false),
|
halted(false),
|
||||||
forceMono(false),
|
forceMono(false),
|
||||||
cmdStreamEnabled(false),
|
cmdStreamEnabled(false),
|
||||||
|
softLocked(0),
|
||||||
|
softLockCount(0),
|
||||||
ticks(0),
|
ticks(0),
|
||||||
curRow(0),
|
curRow(0),
|
||||||
curOrder(0),
|
curOrder(0),
|
||||||
|
|
|
@ -1410,6 +1410,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
||||||
|
|
||||||
if (softLocked) {
|
if (softLocked) {
|
||||||
if (!isBusy.try_lock()) {
|
if (!isBusy.try_lock()) {
|
||||||
|
logV("audio is soft-locked (%d)\n",softLockCount++);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
18
src/log.cpp
18
src/log.cpp
|
@ -17,10 +17,28 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO: improve these routines to allow logging to memory for eventual log window!
|
||||||
|
|
||||||
#include "ta-log.h"
|
#include "ta-log.h"
|
||||||
|
|
||||||
int logLevel=LOGLEVEL_INFO;
|
int logLevel=LOGLEVEL_INFO;
|
||||||
|
|
||||||
|
int logV(const char* format, ...) {
|
||||||
|
va_list va;
|
||||||
|
int ret;
|
||||||
|
if (logLevel<LOGLEVEL_TRACE) return 0;
|
||||||
|
#ifdef _WIN32
|
||||||
|
printf("[trace] ");
|
||||||
|
#else
|
||||||
|
printf("\x1b[1;37m[trace]\x1b[m ");
|
||||||
|
#endif
|
||||||
|
va_start(va,format);
|
||||||
|
ret=vprintf(format,va);
|
||||||
|
va_end(va);
|
||||||
|
fflush(stdout);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int logD(const char* format, ...) {
|
int logD(const char* format, ...) {
|
||||||
va_list va;
|
va_list va;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -109,7 +109,9 @@ bool pConsole(String val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pLogLevel(String val) {
|
bool pLogLevel(String val) {
|
||||||
if (val=="debug") {
|
if (val=="trace") {
|
||||||
|
logLevel=LOGLEVEL_TRACE;
|
||||||
|
} else if (val=="debug") {
|
||||||
logLevel=LOGLEVEL_DEBUG;
|
logLevel=LOGLEVEL_DEBUG;
|
||||||
} else if (val=="info") {
|
} else if (val=="info") {
|
||||||
logLevel=LOGLEVEL_INFO;
|
logLevel=LOGLEVEL_INFO;
|
||||||
|
@ -118,7 +120,7 @@ bool pLogLevel(String val) {
|
||||||
} else if (val=="error") {
|
} else if (val=="error") {
|
||||||
logLevel=LOGLEVEL_ERROR;
|
logLevel=LOGLEVEL_ERROR;
|
||||||
} else {
|
} else {
|
||||||
logE("invalid value for loglevel! valid values are: debug, info, warning, error.\n");
|
logE("invalid value for loglevel! valid values are: trace, debug, info, warning, error.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
#define LOGLEVEL_WARN 1
|
#define LOGLEVEL_WARN 1
|
||||||
#define LOGLEVEL_INFO 2
|
#define LOGLEVEL_INFO 2
|
||||||
#define LOGLEVEL_DEBUG 3
|
#define LOGLEVEL_DEBUG 3
|
||||||
|
#define LOGLEVEL_TRACE 4
|
||||||
|
|
||||||
extern int logLevel;
|
extern int logLevel;
|
||||||
|
|
||||||
|
int logV(const char* format, ...);
|
||||||
int logD(const char* format, ...);
|
int logD(const char* format, ...);
|
||||||
int logI(const char* format, ...);
|
int logI(const char* format, ...);
|
||||||
int logW(const char* format, ...);
|
int logW(const char* format, ...);
|
||||||
|
|
Loading…
Reference in New Issue