On Mon, 6 Mar 2023 13:00:17 -0800 Tyler Retzlaff <roret...@linux.microsoft.com> wrote:
> On Sat, Mar 04, 2023 at 08:04:41AM -0800, Stephen Hemminger wrote: > > On Sat, 4 Mar 2023 16:14:21 +0800 > > luzhipeng <luzhip...@cestc.cn> wrote: > > > > > From: Zhipeng Lu <luzhip...@cestc.cn> > > > > > > add timestamp for log > > > > > > Signed-off-by: Zhipeng Lu <luzhip...@cestc.cn> > > > > Good idea but: > > - it needs to be optional > > - timestamp only makes sense on the terminal (stdout) log stream > > syslog/journal already have timestamp > > +1 > > also, some people who may have written scripts to consume the log output > might get kind of irritated that you suddenly broke the format of the > output. while not strictly an "api" it's not super friendly to break it > unnecessarily. Two additional comments. - since stderr is unbuffered on most OS, the fprintf of the timestamp and then the message is not thread safe. Writes of one thread and another might intermix. Addressed that in my version by using writev - Putting full date is unnecessary overhead better to use seconds since startup (similar to kernel dmesg). Also simpler to calculate.