Silence the firehose of debug logging statements

This commit is contained in:
Cameron Gutman
2018-05-29 20:17:48 -07:00
parent b5241a0c30
commit aea2067e1c
3 changed files with 12 additions and 4 deletions

View File

@@ -112,7 +112,7 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds
}
if (receivedResponse) {
Log(LOG_I, @"Received serverinfo response on try %d", i);
Log(LOG_D, @"Received serverinfo response on try %d", i);
break;
}
else {

View File

@@ -128,14 +128,14 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
status = AudioQueueNewOutput(&audioFormat, FillOutputBuffer, nil, nil, nil, 0, &audioQueue);
if (status != noErr) {
NSLog(@"Error allocating output queue: %d\n", status);
Log(LOG_E, @"Error allocating output queue: %d\n", status);
return status;
}
for (int i = 0; i < AUDIO_QUEUE_BUFFERS; i++) {
status = AudioQueueAllocateBuffer(audioQueue, audioFormat.mBytesPerFrame * FRAME_SIZE, &audioBuffers[i]);
if (status != noErr) {
NSLog(@"Error allocating output buffer: %d\n", status);
Log(LOG_E, @"Error allocating output buffer: %d\n", status);
return status;
}
@@ -144,7 +144,7 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
status = AudioQueueStart(audioQueue, nil);
if (status != noErr) {
NSLog(@"Error starting queue: %d\n", status);
Log(LOG_E, @"Error starting queue: %d\n", status);
return status;
}

View File

@@ -8,6 +8,8 @@
#import "Logger.h"
static LogLevel LoggerLogLevel = LOG_I;
void LogTagv(LogLevel level, NSString* tag, NSString* fmt, va_list args);
void Log(LogLevel level, NSString* fmt, ...) {
@@ -27,6 +29,10 @@ void LogTag(LogLevel level, NSString* tag, NSString* fmt, ...) {
void LogTagv(LogLevel level, NSString* tag, NSString* fmt, va_list args) {
NSString* levelPrefix = @"";
if (level < LoggerLogLevel) {
return;
}
switch(level) {
case LOG_D:
levelPrefix = PRFX_DEBUG;
@@ -41,6 +47,8 @@ void LogTagv(LogLevel level, NSString* tag, NSString* fmt, va_list args) {
levelPrefix = PRFX_ERROR;
break;
default:
levelPrefix = @"";
assert(false);
break;
}
NSString* prefixedString;