Re-add time to message log.

This commit is contained in:
Mitchell Livingston
2006-08-22 02:56:09 +00:00
parent 85ddba7daf
commit 32cdb550fb
2 changed files with 9 additions and 5 deletions

View File

@@ -73,8 +73,8 @@
- (void) updateLog: (NSTimer *) timer
{
tr_msg_list_t * messages = tr_getQueuedMessages(), * currentMessage;
if (!messages)
tr_msg_list_t * messages, * currentMessage;
if (!(messages = tr_getQueuedMessages()))
return;
//keep scrolled to bottom if already at bottom or there is no scroll bar yet
@@ -83,6 +83,7 @@
NSAttributedString * messageString;
NSString * levelString;
NSCalendarDate * dateString;
for (currentMessage = messages; currentMessage != NULL; currentMessage = currentMessage->next)
{
int level = currentMessage->level;
@@ -95,8 +96,11 @@
else
levelString = @"???";
messageString = [[[NSAttributedString alloc] initWithString: [NSString stringWithFormat: @"%@ %s\n",
levelString, currentMessage->message]] autorelease];
dateString = [[NSDate dateWithTimeIntervalSince1970: currentMessage->when]
dateWithCalendarFormat: @"%Y-%m-%d %H:%M:%S" timeZone: nil];
messageString = [[[NSAttributedString alloc] initWithString: [NSString stringWithFormat: @"%@ %@ %s\n",
dateString, levelString, currentMessage->message]] autorelease];
[[fTextView textStorage] appendAttributedString: messageString];
}