func (h *Hook) Levels() []logrus.Level {
	return h.levels
}
Levels returns the logrus levels that this hook is applied to. This can be
set using the Levels Option.
package sdhook
import (
	"encoding/json"
	"errors"
	"fmt"
	"log"
	"net/http"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/facebookgo/stack"
	"github.com/fluent/fluent-logger-golang/fluent"
	"github.com/sirupsen/logrus"
	errorReporting "google.golang.org/api/clouderrorreporting/v1beta1"
	"google.golang.org/api/googleapi"
	logging "google.golang.org/api/logging/v2"
)
const defaultName = "default"
type Hook struct {
	levels []logrus.Level
	projectID string
	service *logging.EntriesService
	errorService *errorReporting.Service
	resource *logging.MonitoredResource
	logName string
	labels map[string]string
	partialSuccess bool
	agentClient *fluent.Fluent
	errorReportingServiceName string
	errorReportingLogName string
	useLoggingServiceForErrors bool
	waitGroup sync.WaitGroup
}
func New(opts ...Option) (*Hook, error) {
	h := &Hook{
		levels: logrus.AllLevels,
	}
	for _, o := range opts {
		if err := o(h); err != nil {
			return nil, err
		}
	}
	if h.service == nil && h.agentClient == nil {
		return nil, errors.New("no stackdriver service was provided")
	}
	if h.resource == nil && h.agentClient == nil {
		return nil, errors.New("the monitored resource was not provided")
	}
	if h.projectID == "" && h.agentClient == nil {
		return nil, errors.New("the project id was not provided")
	}
	if h.logName == "" {
		if err := LogName(defaultName)(h); err != nil {
			return nil, err
		}
	}
	if h.errorReportingLogName == "" {
		h.errorReportingLogName = h.logName + "_errors"
	}
	return h, nil
}