Android custom log

Source: Internet
Author: User

The following is a draft of a previously edited custom log. Now, I don't remember the va_list function,

I should have written it clearly at the beginning, and now I am too lazy to read it.

/** My log for trace code */# ifndef mylog # define mylog (...) \ mylog_print (android_log_error, log_tag, _ va_args _) # define mylog_print (PRIO, Tag, FMT ...) \ myprint (PRIO, Tag, FMT) # define log_buf_size 1024 static long myno = 0; static int myprint (INT Prio, const char * tag, const char * FMT ,...) {va_list AP; char * my_tag = "*** it's my log! * ** No. "; int Len; char Buf [log_buf_size]; Len = sprintf (BUF," % S % ld: ", my_tag, myno ++); va_start (AP, FMT ); vsnprintf (BUF + Len, LOG_BUF_SIZE-len, FMT, AP); va_end (AP); Return _ android_log_write (PRIO, Tag, Buf );} # endif/** end my log */

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.