lundi 2 février 2015

iPhone iOS Apple System Log facility Going Backwards

Found this code at



http://ift.tt/1690cnI


And it works pretty well. But it is giving the log going forwards for the current iOS application. I have read the docs a bit, but trying to figure out how to get the results to return previous application logs.



aslmsg q, m;
int i;
const char *key, *val;

q = asl_new(ASL_TYPE_QUERY);

aslresponse r = asl_search(NULL, q);
while (NULL != (m = aslresponse_next(r)))
{
NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];

for (i = 0; (NULL != (key = asl_key(m, i))); i++)
{
NSString *keyString = [NSString stringWithUTF8String:(char *)key];

val = asl_get(m, key);

NSString *string = val?[NSString stringWithUTF8String:val]:@"";
[tmpDict setObject:string forKey:keyString];
}
}
aslresponse_free(r);



Aucun commentaire:

Enregistrer un commentaire