Commit 6aeee1b5 authored by sletz's avatar sletz
Browse files

Configurable logging in libjacknet.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4755 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 06e0433f
......@@ -496,6 +496,11 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf
int Open(jack_master_t* result)
{
if ((fParams.fSampleEncoder == JackCeltEncoder) && (fParams.fKBps == 0)) {
jack_error("CELT encoder with 0 for kps...");
return -1;
}
if (fParams.fNetworkLatency > NETWORK_MAX_LATENCY) {
jack_error("Error : network latency is limited to %d", NETWORK_MAX_LATENCY);
return -1;
......@@ -988,25 +993,26 @@ LIB_EXPORT int jack_adapter_pull_and_push(jack_adapter_t* adapter, float** input
return slave->PullAndPush(input, output, frames);
}
//#ifdef MY_TARGET_OS_IPHONE
#if 1
static void jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap)
{
char buffer[300];
size_t len;
const char* netjack_log = getenv("JACK_NETJACK_LOG");
bool is_netjack_log = (netjack_log) ? atoi(netjack_log) : 0;
if (prefix != NULL) {
len = strlen(prefix);
memcpy(buffer, prefix, len);
} else {
len = 0;
}
if (is_netjack_log) {
char buffer[300];
size_t len;
vsnprintf(buffer + len, sizeof(buffer) - len, fmt, ap);
printf("%s", buffer);
printf("\n");
if (prefix != NULL) {
len = strlen(prefix);
memcpy(buffer, prefix, len);
} else {
len = 0;
}
vsnprintf(buffer + len, sizeof(buffer) - len, fmt, ap);
printf("%s", buffer);
printf("\n");
}
}
LIB_EXPORT void jack_error(const char *fmt, ...)
......@@ -1032,19 +1038,3 @@ LIB_EXPORT void jack_log(const char *fmt, ...)
jack_format_and_log(LOG_LEVEL_INFO, "Jack: ", fmt, ap);
va_end(ap);
}
#else
// Empty code for now..
LIB_EXPORT void jack_error(const char *fmt, ...)
{}
LIB_EXPORT void jack_info(const char *fmt, ...)
{}
LIB_EXPORT void jack_log(const char *fmt, ...)
{}
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment