android 记录时间戳添加

android log's time-stamp addition

在查看 android 日志框架时 - 我检查了 /dev/log/main |系统 |事件日志文件。在这些日志文件中,我没有看到时间戳。但同时 "logcat -v time" 显示时间戳和日志。

我检查 Logcat 代码它从 /dev/log/* 缓冲区读取 androidlog_entry 并在 cmdline 上显示。

在跟踪 android 日志记录代码时,我找不到我们在什么时候在日志中添加时间戳。

我确实跟踪了以下流程 - LOGI("pre_alloc_cap_mem_thread_init: inited=%d", obj->mPreAllocCapMemInited); #define 日志 ALOGE #define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, VA_ARGS)) #define LOG_PRI(优先级,标签,...)\ android_printLog(优先级,标签,VA_ARGS) #define android_printLog(prio, tag, fmt...) \ __android_log_print(prio, tag, fmt)

 int __android_log_print(int prio, const char *tag, const char *fmt, ...)
 {
     va_list ap;
     char buf[LOG_BUF_SIZE];

     va_start(ap, fmt);
     vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
     va_end(ap);

     return __android_log_write(prio, tag, buf);
 }

一直持续到 NR_writev 系统调用。 当它向 android 日志添加时间戳时,有人可以指导我吗?

感谢帮助..我能得到什么.. 但我已经弄清楚了- "Android frame work does not add time stamp, threadid etc. to android logs that goes to /dev/log/, but It rather pass it down to kernel to logger driver(check logger.c in kernel code) that further add up the timestamp+PID etc. as prefix to each android log. "