The Timestamp field is optional in the Emit a LogRecord API and in the data model.
However, is there a reasonable expectation that by default all log records are generated "now" and should be stamped with the current time?
Should we set Timestamp to the current time if it is not specified?
The one opposing argument I can think of is that somehow the user obtains the log record externally, and the external source does not include the information about when the log record was created. In this case keeping the Timestamp unspecified is desirable, to indicate that it is unknown. Here is what the data model says about the Timestamp field:
Time when the event occurred measured by the origin clock, i.e. the time at the source. This field is optional, it may be missing if the source timestamp is unknown.
If we do not by default set the Timestamp to the current time then it is the responsibility of the caller who is implementing the bridge to always set the Timestamp. This sounds like a reasonable requirement to me.
This behavior would be surprising for end-user facing logging API, but this is not an end-user facing logging API. It is optimized for Bridges and the preference is likely that we are able to explicitly indicate that the timestamp is not known.
The discussion triggered by this comment.
The Timestamp field is optional in the Emit a LogRecord API and in the data model.
However, is there a reasonable expectation that by default all log records are generated "now" and should be stamped with the current time?
Should we set Timestamp to the current time if it is not specified?
The one opposing argument I can think of is that somehow the user obtains the log record externally, and the external source does not include the information about when the log record was created. In this case keeping the Timestamp unspecified is desirable, to indicate that it is unknown. Here is what the data model says about the Timestamp field:
If we do not by default set the Timestamp to the current time then it is the responsibility of the caller who is implementing the bridge to always set the Timestamp. This sounds like a reasonable requirement to me.
This behavior would be surprising for end-user facing logging API, but this is not an end-user facing logging API. It is optimized for Bridges and the preference is likely that we are able to explicitly indicate that the timestamp is not known.
The discussion triggered by this comment.