file_handler.go
func (handler *FileHandler) Handle(record *Record) error {
	handler.lock.Lock()
	defer handler.lock.Unlock()

	msg := handler.Formatter.Format(record) + "\n"

	if handler.writer == nil {

		if err := handler.open(); err != nil {
			return err
		}
	}

	_, err := handler.writer.Write([]byte(msg))
	if err != nil {
		return err
	}
	handler.writer.Flush()

	return nil
}
func (handler *FileHandler) Handle(record *Record) error {
	handler.lock.Lock()
	defer handler.lock.Unlock()

	msg := handler.Formatter.Format(record) + "\n"

	if handler.writer == nil {

		if err := handler.open(); err != nil {
			return err
		}
	}

	_, err := handler.writer.Write([]byte(msg))
	if err != nil {
		return err
	}
	handler.writer.Flush()

	return nil
}
// Handle writes message from log record into file.