Go's built-in logging handlers use a mutex lock before writing to ensure that log records from multiple goroutines are never interleaved. However, timestamps are not used to sort records, so out-of-order log entries are possible. Custom handler implementations must manage their own locking and sorting to achieve the same guarantees.
24.5K Impressions1 Comment