use a maximum number of messages
This commit is contained in:
parent
830f65e9b5
commit
2e74340491
Binary file not shown.
|
@ -30,7 +30,7 @@
|
||||||
#define LEVEL_DEBUG 2
|
#define LEVEL_DEBUG 2
|
||||||
|
|
||||||
#define UPDATE_SECONDS 0.6
|
#define UPDATE_SECONDS 0.6
|
||||||
//#define MAX_LINES 2500
|
#define MAX_MESSAGES 2500
|
||||||
|
|
||||||
@interface MessageWindowController (Private)
|
@interface MessageWindowController (Private)
|
||||||
|
|
||||||
|
@ -130,14 +130,17 @@
|
||||||
[[fTextView textStorage] deleteCharactersInRange: NSMakeRange(0, loc + 1)];
|
[[fTextView textStorage] deleteCharactersInRange: NSMakeRange(0, loc + 1)];
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
#warning remove old messages?
|
|
||||||
|
|
||||||
[fMessages addObject: [NSDictionary dictionaryWithObjectsAndKeys:
|
[fMessages addObject: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSString stringWithUTF8String: currentMessage->message], @"Message",
|
[NSString stringWithUTF8String: currentMessage->message], @"Message",
|
||||||
[NSDate dateWithTimeIntervalSince1970: currentMessage->when], @"Date",
|
[NSDate dateWithTimeIntervalSince1970: currentMessage->when], @"Date",
|
||||||
levelString, @"Level", nil]];
|
levelString, @"Level", nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning still needed?
|
||||||
|
int total = [fMessages count];
|
||||||
|
if (total > MAX_MESSAGES)
|
||||||
|
[fMessages removeObjectsInRange: NSMakeRange(0, total-MAX_MESSAGES)];
|
||||||
|
|
||||||
[fMessageView reloadData];
|
[fMessageView reloadData];
|
||||||
|
|
||||||
tr_freeMessageList(messages);
|
tr_freeMessageList(messages);
|
||||||
|
|
Loading…
Reference in New Issue