You can add ".#" the time format in ASL (and syslog) to indicate accuracy. Thus, "utc.3" will be formatted in UTC with milliseconds. You can add this to the msg_fmt or time_fmt .
The accuracy of the time format seems to be documented only in syslogd (1) . I am not sure why he did not do this asl (3) .
For example, using asl_add_output_file and pointing to time_fmt might look like this:
// setup, do once! aslclient log = asl_open(NULL, NULL, 0); asl_add_output_file(log, STDERR_FILENO, "$Time $((Level)(str)) - $Message", // $Time here uses time_fmt arg on next line ASL_TIME_FMT_UTC ".3", // time_fmt: append ".3" for milliseconds here ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG), ASL_ENCODE_SAFE); // example log asl_log(log, NULL, ASL_LEVEL_INFO, "Hello"); // Note in the above ASL_TIME_FMT_UTC is
and conclusion:
2016-02-01 19:16:39.561Z Info - Hello
An indication in the msg_fmt asl_add_output_file argument may look like this:
// setup, do once! aslclient log = asl_open(NULL, NULL, 0); asl_add_output_file(log, STDERR_FILENO, // in msg_fmt below, use ISO8601 + ".6" for microseconds "$((Time)(ISO8601.6)) $((Level)(str)) - $Message", ASL_TIME_FMT_UTC, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG), ASL_ENCODE_SAFE); // example log asl_log(log, NULL, ASL_LEVEL_INFO, "Hello");
and conclusion:
2016-02-01T14:16:39.562030-05 Info - Hello
(I would caution that the above code snippets are intended only to demonstrate the accuracy of the time format in ASL. Actual use will most likely include dispatch_once for configuration, use the sequential send queue for logging.)