Page MenuHome

Add --log-console and --log-show-timestamp options
AbandonedPublic

Authored by Andrew Williams (sobakasu) on Jan 16 2019, 2:12 AM.

Details

Summary

I added two new options

--log-show-timestamp adds a timestamp to the beginning of each log output line
--log-console sends log output to console (to be used with --log-file, so you can have the log output display on the console and also sent to a file)

also, CLG_log_str was basically the same as CLG_logf so I deleted it and made it call CLG_logf

Diff Detail

Repository
rB Blender
Branch
T (branched from master)
Build Status
Buildable 2739
Build 2739: arc lint + arc unit

Event Timeline

Andrew Williams (sobakasu) created this revision.
Andrew Williams (sobakasu) edited the summary of this revision. (Show Details)

fixed diff

LazyDodo (LazyDodo) added inline comments.
intern/clog/clog.c
359

This will use the system timer which has 10-16ms precision. seems fine for some casual logging, @Campbell Barton (campbellbarton) will have to decide here.

Committed --log-show-timestamp with edits: rBc383d742288025da1eb26417c614f56a3c500b5d

  • Remove BOOL use.
  • Store the start time in the logging context (wasn't threadsafe).
  • Don't make CLG_log_str wrap CLG_logf (avoid small overhead in redundant string formatting), we could de-duplicate the code some other way.
  • Use PRIu64 for string formatting.

I didn't include --log-console because I'm not sure its all that useful? why not monitor the file directly instead?

Also, the name is a bit confusing, I had to read the code to check what it meant exactly.

Updated diff since --log-show-timestamp is now in master.

Accidental minor change left in.

thanks for committing the timestamp functionality

  • Remove BOOL use.

I randomly used that because visual studio was complaining about 'bool' for some reason, but then later it stopped complaining. so that's weird.

  • Use PRIu64 for string formatting.

I haven't seen that before, that's cool

I didn't include --log-console because I'm not sure its all that useful? why not monitor the file directly instead?

this is probably unnecessary, as you can just monitor the log file like you said.

Closing then, we can add this later if someone needs it

Thanks for the patch.