当前位置: 首页>>代码示例>>Golang>>正文


Golang logrus.Info函数代码示例

本文整理汇总了Golang中github.com/Sirupsen/logrus.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: verifyEPs

func (s *systemtestSuite) verifyEPs(containers []*container) error {
	var err error

	// get the list of eps to verify
	epList := make([]string, len(containers))
	for ix, cont := range containers {
		epList[ix] = cont.eth0.ip
	}

	err = nil
	dbgOut := ""
	for try := 0; try < 20; try++ {
		for _, n := range s.nodes {
			if n.Name() == "k8master" {
				continue
			}
			dbgOut, err = n.verifyEPs(epList)
			if err != nil {
				break
			}
		}

		if err == nil {
			logrus.Info("EPs %+v verified on all nodes", epList)
			return nil
		}
		time.Sleep(1 * time.Second)
	}
	logrus.Errorf("Failed to verify EPs after 20 sec %v", err)
	logrus.Info("Debug output:\n %s", dbgOut)
	return err
}
开发者ID:abhinandanpb,项目名称:netplugin,代码行数:32,代码来源:util_test.go

示例2: PrintRunningStep

// PrintRunningStep ...
func PrintRunningStep(title, version string, idx int) {
	if len(version) > 25 {
		version = "..." + stringutil.MaxLastChars(version, 22)
	}
	content := fmt.Sprintf("| (%d) %s (%s) |", idx, title, version)
	charDiff := len(content) - stepRunSummaryBoxWidthInChars

	if charDiff < 0 {
		// shorter than desired - fill with space
		content = fmt.Sprintf("| (%d) %s (%s)%s |", idx, title, version, strings.Repeat(" ", -charDiff))
	} else if charDiff > 0 {
		// longer than desired - trim title
		trimmedTitleWidth := len(title) - charDiff - 3
		if trimmedTitleWidth < 0 {
			log.Errorf("Step Version too long, can't present title at all! : %s", version)
		} else {
			content = fmt.Sprintf("| (%d) %s... (%s) |", idx, title[0:trimmedTitleWidth], version)
		}
	}

	sep := strings.Repeat("-", len(content))
	log.Info(sep)
	log.Infof(content)
	log.Info(sep)
	log.Info("|" + strings.Repeat(" ", stepRunSummaryBoxWidthInChars-2) + "|")
}
开发者ID:bitrise-io,项目名称:bitrise-yml-converter,代码行数:27,代码来源:print.go

示例3: setupLogging

func setupLogging() {
	if config.Settings.Moire.Debug {
		log.Info("Logging in DEBUG mode")
		log.SetLevel(log.DebugLevel)
	}

	// log.SetFlags(log.Ldate | log.Ltime | log.Llongfile)
	log.SetFormatter(&log.TextFormatter{})

	if config.Settings.Moire.SentryDSN != "" {
		levels := []log.Level{
			log.PanicLevel,
			log.FatalLevel,
			log.ErrorLevel,
		}

		hook, err := logrus_sentry.NewSentryHook(config.Settings.Moire.SentryDSN, levels)
		if err != nil {
			log.Error("Unable to connect to sentry")
		} else {
			log.Info("Adding Sentry Hook")
			log.AddHook(hook)
		}
	}
}
开发者ID:josjevv,项目名称:moire,代码行数:25,代码来源:setup.go

示例4: OptionKVOpts

// OptionKVOpts function returns an option setter for kvstore options
func OptionKVOpts(opts map[string]string) Option {
	return func(c *Config) {
		if opts["kv.cacertfile"] != "" && opts["kv.certfile"] != "" && opts["kv.keyfile"] != "" {
			log.Info("Option Initializing KV with TLS")
			tlsConfig, err := tlsconfig.Client(tlsconfig.Options{
				CAFile:   opts["kv.cacertfile"],
				CertFile: opts["kv.certfile"],
				KeyFile:  opts["kv.keyfile"],
			})
			if err != nil {
				log.Errorf("Unable to set up TLS: %s", err)
				return
			}
			if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
				c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
			}
			if c.Scopes[datastore.GlobalScope].Client.Config == nil {
				c.Scopes[datastore.GlobalScope].Client.Config = &store.Config{TLS: tlsConfig}
			} else {
				c.Scopes[datastore.GlobalScope].Client.Config.TLS = tlsConfig
			}
			// Workaround libkv/etcd bug for https
			c.Scopes[datastore.GlobalScope].Client.Config.ClientTLS = &store.ClientTLSConfig{
				CACertFile: opts["kv.cacertfile"],
				CertFile:   opts["kv.certfile"],
				KeyFile:    opts["kv.keyfile"],
			}
		} else {
			log.Info("Option Initializing KV without TLS")
		}
	}
}
开发者ID:contiv,项目名称:docker,代码行数:33,代码来源:config.go

示例5: Start

// Start implementation of the tether.Extension interface
func (t *Toolbox) Start() error {
	t.Service.PrimaryIP = t.defaultIP

	t.stop = make(chan struct{})
	on := make(chan struct{})

	t.Service.PowerCommand.PowerOn.Handler = func() error {
		log.Info("toolbox: service is ready (power on event received)")
		close(on)
		return nil
	}

	err := t.Service.Start()
	if err != nil {
		return err
	}

	// Wait for the vmx to send the OS_PowerOn message,
	// at which point it will be ready to service vix command requests.
	log.Info("toolbox: waiting for initialization")

	select {
	case <-on:
	case <-time.After(time.Second):
		log.Warn("toolbox: timeout waiting for power on event")
	}

	return nil
}
开发者ID:kjplatz,项目名称:vic,代码行数:30,代码来源:toolbox.go

示例6: buildRedirectURL

func buildRedirectURL(core *roll.Core, w http.ResponseWriter, responseType, subject, scope string, app *roll.Application) (string, error) {
	log.Info("build redirect, app ctx: ", app.RedirectURI)

	var redirectURL string
	switch responseType {
	case "token":
		//Create signed token
		token, err := generateJWT(subject, scope, core, app)
		if err != nil {
			return "", err
		}
		redirectURL = fmt.Sprintf("%s#access_token=%s&token_type=Bearer", app.RedirectURI, token)
	case "code":
		token, err := generateSignedCode(core, subject, scope, app)
		if err != nil {
			return "", err
		}
		redirectURL = fmt.Sprintf("%s?code=%s", app.RedirectURI, token)
	default:
		panic(errors.New("unexpected response type in buildRedirectURL: " + responseType))
	}

	log.Info("redirect url: ", redirectURL)

	return redirectURL, nil
}
开发者ID:xtraclabs,项目名称:roll,代码行数:26,代码来源:authz.go

示例7: runVault

func runVault(docker *dockerclient.DockerClient) (string, string) {
	var bootedContainer bool

	//Is vault running?
	log.Info("Is vault running?")
	info := dockerutil.GetAcceptanceTestContainerInfo(docker, "atest-vault")

	if info != nil {
		log.Info("Vault container found - state is: ", info.State.StateString())
		log.Fatal("You must kill and remove the container manually - can't get the root token from an existing container in this test")
		return "", "" //not reached
	}

	log.Info("Vault is not running - create container context")
	bootedContainer = true
	vaultContainerCtx := createVaultTestContainerContext()

	//Create and start the container.
	log.Info("Create and start the container")
	containerId := dockerutil.CreateAndStartContainer(docker, []string{"IPC_LOCK"}, nil, vaultContainerCtx)

	if bootedContainer {
		//Give the container a little time to boot
		time.Sleep(1 * time.Second)
	}

	//Now initialize and unseal the damn vault
	rootToken := initializeVault()

	return containerId, rootToken
}
开发者ID:xtraclabs,项目名称:roll,代码行数:31,代码来源:runvaultmachine.go

示例8: createVolume

func (s *systemtestSuite) createVolume(host, tenant, name string, opts map[string]string) error {
	log.Infof("Creating %s/%s on %s", tenant, name, host)

	optsStr := []string{}

	if opts != nil {
		for key, value := range opts {
			optsStr = append(optsStr, "--opt")
			optsStr = append(optsStr, key+"="+value)
		}
	}

	cmd := fmt.Sprintf("docker volume create -d volplugin --name %s/%s %s", tenant, name, strings.Join(optsStr, " "))

	if out, err := s.vagrant.GetNode(host).RunCommandWithOutput(cmd); err != nil {
		log.Info(string(out))
		return err
	}

	if out, err := s.volcli(fmt.Sprintf("volume get %s %s", tenant, name)); err != nil {
		log.Error(out)
		return err
	}

	if out, err := s.vagrant.GetNode(host).RunCommandWithOutput(cmd); err != nil {
		log.Info(string(out))
		return err
	}

	return nil
}
开发者ID:hankerepo,项目名称:volplugin,代码行数:31,代码来源:util_test.go

示例9: BuildConnection

func BuildConnection(ws *websocket.Conn) {
	log.Info("BuildConnection()")
	token := ws.Request().URL.Query().Get("token")
	log.Debug(token)
	var uci userConnectionInfo
	err := validateToken(token, time.Now(), ws.RemoteAddr(), &uci)
	if err != nil {
		log.WithFields(log.Fields{
			"error": err,
		}).Error("validation error")
		// how should this reply to the client?
		return
	}

	onlineUser := &OnlineUser{
		Connection: ws,
		Uci:        uci,
		Send:       make(chan envelope, 256),
	}
	runningRoom.Users[onlineUser] = true
	go onlineUser.PushToClient()
	onlineUser.PullFromClient()
	delete(runningRoom.Users, onlineUser)
	log.Info("tore down user connection")
}
开发者ID:thraxil,项目名称:windsock,代码行数:25,代码来源:windsock.go

示例10: NewLoadBalancer

//NewLoadBalancer creates a new instance of a Round Robin load balancer
func (rrf *RoundRobinLoadBalancerFactory) NewLoadBalancer(backendName, caCertPath string, servers []config.ServerConfig) (LoadBalancer, error) {
	var rrlb RoundRobinLoadBalancer

	if backendName == "" {
		return nil, fmt.Errorf("Expected non-empty backend name")
	}

	if len(servers) == 0 {
		return nil, fmt.Errorf("Expected at least one server in servers argument")
	}

	rrlb.backend = backendName
	rrlb.servers = ring.New(len(servers))

	for _, s := range servers {

		lbEndpoint := new(LoadBalancerEndpoint)
		lbEndpoint.Address = fmt.Sprintf("%s:%d", s.Address, s.Port)
		metrics.SetGauge([]string{"endpoint", lbEndpoint.Address}, 1.0)
		lbEndpoint.PingURI = s.PingURI
		lbEndpoint.Up = true
		lbEndpoint.CACertPath = caCertPath

		log.Info("Spawing health check for address ", lbEndpoint.Address)
		healthCheckFunction := MakeHealthCheck(lbEndpoint, s, true)
		go healthCheckFunction()

		log.Info("Adding server with address ", lbEndpoint.Address)
		rrlb.servers.Value = lbEndpoint
		rrlb.servers = rrlb.servers.Next()
	}

	return &rrlb, nil
}
开发者ID:xtracdev,项目名称:xavi,代码行数:35,代码来源:roundrobin.go

示例11: TestFormat1TestSuite

// In order for 'go test' to run this suite, we need to create
// a normal test function and pass our suite to suite.Run
func TestFormat1TestSuite(t *testing.T) {
	//ts := new(Format1TestSuite)
	log.Info("TestFormat1TestSuite - Running test suite")
	suite.Run(t, new(Format1TestSuite))
	log.Info("TestFormat1TestSuite - Finished test suite")

}
开发者ID:jlgerber,项目名称:sg-restful,代码行数:9,代码来源:format1_test.go

示例12: importCountries

func importCountries(conn *transaction.Connection, config model.YAMLCountries) (err error) {
	log.Info("Import countries started")

	if err = conn.RemoveCountriesTranslations(); err != nil {
		return
	}
	for countryCode, country := range config.Countries {
		if conn.IsCountryExist(countryCode) == false {
			err = errors.New("Missing country")
			break
		}

		errorInsideTranslation := false
		for languageCode, translation := range country.Translations {
			if conn.IsLanguageExist(languageCode) == false {
				errorInsideTranslation = true
				err = errors.New("No language")
				break
			}

			if err = conn.CreateCountryTranslation(countryCode, languageCode, translation); err != nil {
				errorInsideTranslation = true
				break
			}
		}

		if errorInsideTranslation == true {
			break
		}
	}
	log.Info("Import countries finished")
	return
}
开发者ID:helphone,项目名称:importer,代码行数:33,代码来源:importer.go

示例13: importPhoneNumbersCategories

func importPhoneNumbersCategories(conn *transaction.Connection, config model.YAMLPhoneNumbersCategories) (err error) {
	log.Info("Import phonenumber categories started")

	if err = conn.RemovePhonenumbersAndCategories(); err != nil {
		return
	}

	for categoryCode, category := range config.Categories {
		if err = conn.CreatePhonenumberCategory(categoryCode); err != nil {
			break
		}

		errorInsideTranslation := false
		for languageCode, translation := range category.Translations {
			if conn.IsLanguageExist(languageCode) == false {
				errorInsideTranslation = true
				err = errors.New("No language")
				break
			}

			if err = conn.CreatePhonenumberCategoryTranslation(categoryCode, languageCode, translation); err != nil {
				errorInsideTranslation = true
				break
			}
		}

		if errorInsideTranslation == true {
			break
		}
	}
	log.Info("Import phonenumber categories finished")
	return
}
开发者ID:helphone,项目名称:importer,代码行数:33,代码来源:importer.go

示例14: getVersions

func (r *Runner) getVersions(options *flags.Options) (siVersion, cloudVersion int, err error) {
	var siError, cloudError error
	versionChan := make(chan struct{}, 2)

	go func() {
		siVersion, siError = r.imgDataOrigin.GetLatestVersion(options)
		log.Info("siVersion: ", siVersion)
		versionChan <- struct{}{}
	}()

	go func() {
		cloudVersion, cloudError = r.imgDataTarget.GetLatestVersion(options)
		log.Info("cloudVersion: ", cloudVersion)
		versionChan <- struct{}{}
	}()

	for i := 0; i < 2; i++ {
		<-versionChan
	}

	if siError != nil {
		return 0, 0, siError
	}
	if cloudError != nil {
		if _, ok := cloudError.(*cloud.ErrVersionNotFound); !ok {
			return 0, 0, cloudError
		}
	}
	return
}
开发者ID:fgimenez,项目名称:snappy-cloud-image,代码行数:30,代码来源:runner.go

示例15: GetManifestsV2Handler

//GetManifestsV2Handler is
func GetManifestsV2Handler(ctx *macaron.Context) (int, []byte) {
	repository := ctx.Params(":repository")
	namespace := ctx.Params(":namespace")
	tag := ctx.Params(":tag")

	t := new(models.DockerTagV2)
	if _, err := t.Get(namespace, repository, tag); err != nil && err == gorm.ErrRecordNotFound {
		log.Info("Not found repository in tetting tag manifest: %s/%s:%s", namespace, repository, tag)

		result, _ := module.EncodingError(module.BLOB_UNKNOWN, fmt.Sprintf("%s/%s", namespace, repository))
		return http.StatusNotFound, result
	} else if err != nil && err != gorm.ErrRecordNotFound {
		log.Info("Failed to get tag manifest %s/%s:%s : ", namespace, repository, tag, err.Error())

		result, _ := module.EncodingError(module.UNKNOWN, err.Error())
		return http.StatusBadRequest, result
	}

	digest, _ := signature.DigestManifest([]byte(t.Manifest))

	ctx.Resp.Header().Set("Content-Type", "application/vnd.docker.distribution.manifest.v2+json")
	ctx.Resp.Header().Set("Docker-Content-Digest", digest)
	ctx.Resp.Header().Set("Content-Length", fmt.Sprint(len(t.Manifest)))

	return http.StatusOK, []byte(t.Manifest)
}
开发者ID:pombredanne,项目名称:dockyard,代码行数:27,代码来源:dockerv2.go


注:本文中的github.com/Sirupsen/logrus.Info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。