Vivek Bansal
Vivek Bansal

Reputation: 1326

CCLog with System Time like NSLog

For checking efficiency of code I need to know time taken in execution of code.With NSlog is easy to know as it shows time up to ms.How can i achieve this through CClog

Example NSLog

 2013-12-03 10:11:58.091 xxxx[12786:c07] START....
 2013-12-03 10:12:04.281 xxxx

In CCLog just

 Cocos2d:

Upvotes: 1

Views: 355

Answers (1)

KARTHIK  RA
KARTHIK RA

Reputation: 469

In CCCommon.mm

Replace this...

void CCLog(const char * pszFormat, ...)

{

    printf("Cocos2d: ");
    char szBuf[kMaxLogLen+1] = {0};
    va_list ap;
    va_start(ap, pszFormat);
    vsnprintf(szBuf, kMaxLogLen, pszFormat, ap);
    va_end(ap);
    printf("%s", szBuf);
    printf("\n");
}

To this...

void CCLog(const char * pszFormat, ...)

{

    //printf("Cocos2d: ");
    char szBuf[kMaxLogLen+1] = {0};
    va_list ap;
    va_start(ap, pszFormat);
    vsnprintf(szBuf, kMaxLogLen, pszFormat, ap);
    va_end(ap);
    //printf("%s", szBuf);
    //printf("\n");

    NSLog(@"%s", szBuf);
}

Upvotes: 1

Related Questions