logging.go
func (logger *Logger) WaitForUnprocessedRecords() {
	runtime.Gosched()
	var (
		diff     uint64
		diffPrev uint64
		i        uint8
	)
	for {
		diff = atomic.LoadUint64(&logger.countIn) - atomic.LoadUint64(&logger.countOut)
		if diff == diffPrev {
			i++
		}
		if i >= 100 {
			return
		}
		if diff > 0 {
			diffPrev = diff
			time.Sleep(10 * time.Millisecond)
		} else {
			return
		}
	}
}
func (logger *Logger) WaitForUnprocessedRecords() {
	runtime.Gosched()
	var (
		diff     uint64
		diffPrev uint64
		i        uint8
	)
	for {
		diff = atomic.LoadUint64(&logger.countIn) - atomic.LoadUint64(&logger.countOut)
		if diff == diffPrev {
			i++
		}
		if i >= 100 {
			return
		}
		if diff > 0 {
			diffPrev = diff
			time.Sleep(10 * time.Millisecond)
		} else {
			return
		}
	}
}
// WaitForUnprocessedRecords block execution until all unprocessed log records
// for this logger are processed.
// In order to wait for processing in all loggers, logging.WaitForAllUnprocessedRecords
// can be used.