func (logger *Logger) run() {
	defer func() {
		logger.WaitForUnprocessedRecords()
		logger.closeHandlers()
	}()
recordLoop:
	for {
		select {
		case record := <-logger.recordChannel:
			record.process(logger)
		case state := <-logger.stateChannel:
			switch state {
			case stopped:
				break recordLoop
			case paused:
			stateLoop:
				for {
					select {
					case state := <-logger.stateChannel:
						switch state {
						case stopped:
							break recordLoop
						case running:
							break stateLoop
						default:
							continue
						}
					}
				}
			}
		}
	}
}
func (logger *Logger) run() {
	defer func() {
		logger.WaitForUnprocessedRecords()
		logger.closeHandlers()
	}()
recordLoop:
	for {
		select {
		case record := <-logger.recordChannel:
			record.process(logger)
		case state := <-logger.stateChannel:
			switch state {
			case stopped:
				break recordLoop
			case paused:
			stateLoop:
				for {
					select {
					case state := <-logger.stateChannel:
						switch state {
						case stopped:
							break recordLoop
						case running:
							break stateLoop
						default:
							continue
						}
					}
				}
			}
		}
	}
}
func ( logger * Logger ) run ( ) { defer func ( ) { logger . WaitForUnprocessedRecords ( ) logger . closeHandlers ( ) } ( ) recordLoop : for { select { case record := <- logger . recordChannel : record . process ( logger ) case state := <- logger . stateChannel : switch state { case stopped : break recordLoop case paused : stateLoop : for { select { case state := <- logger . stateChannel : switch state { case stopped : break recordLoop case running : break stateLoop default : continue } } } } } } }
// run starts async log records processing.
run starts async log records processing .