最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How can precision be improved for the debug log timestamp?

programmeradmin1浏览0评论

Sometimes, I write info to the debug log to diagnose problems. While working on a performance problem, resolution to hours:minutes:seconds is not enough. I'd like to get to milliseconds, but haven't yet found the place to make the change. Ideas?

FWIW, this is what the default timestamp looks like: [08-May-2020 23:16:38 UTC]

THANKS for any advice.

Sometimes, I write info to the debug log to diagnose problems. While working on a performance problem, resolution to hours:minutes:seconds is not enough. I'd like to get to milliseconds, but haven't yet found the place to make the change. Ideas?

FWIW, this is what the default timestamp looks like: [08-May-2020 23:16:38 UTC]

THANKS for any advice.

Share Improve this question asked May 8, 2020 at 23:50 Bob EastonBob Easton 1231 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

WordPress does not manage the format of the timestamp. Instead, WordPress hands off error message contents to the PHP function error_log(), which creates the timestamp.

Finding no easy way to ask error_log() for higher resolution timestamp, combined with the fact that I'm creating the message content myself, I've added a microsecond string ahead of my messages, essentially like this:

error_log( gettimeofday()['usec'] . ' ' . $message );
发布评论

评论列表(0)

  1. 暂无评论