func getLogTimestamp()

in logger/common.go [396:428]


func getLogTimestamp(
	isFirstPartial, isPartialMsg bool,
	partialTimestamp time.Time,
	containerID string,
) (time.Time, time.Time, bool, bool) {
	msgTimestamp := time.Now().UTC()

	// If it is not end with with newline for the first time, record it as a partial
	// message and set it to be the first partial. Then record the timestamp as the
	// timestamp of the whole log message.
	if isFirstPartial {
		partialTimestamp = msgTimestamp
		if debug.Verbose {
			debug.SendEventsToLog(containerID,
				fmt.Sprintf("Saving first partial at time %s", partialTimestamp.String()),
				debug.DEBUG, 0)
		}
		// Set isFirstPartial to false and set indicator of partial log message to be true.
		isFirstPartial = false
		isPartialMsg = true
	} else if isPartialMsg {
		// If there are more partial messages recorded before the current read, use the
		// recorded timestamp as it of the current message as well.
		msgTimestamp = partialTimestamp
		if debug.Verbose {
			debug.SendEventsToLog(containerID,
				fmt.Sprintf("Setting partial log message to time %s", msgTimestamp.String()),
				debug.DEBUG, 0)
		}
	}

	return msgTimestamp, partialTimestamp, isFirstPartial, isPartialMsg
}