• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang logrus.WithField函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: readActionDefinition

func readActionDefinition(actionName []string, dropped map[string]string, varNum int) (*viper.Viper, map[string]string, error) {
	if len(actionName) == 0 {
		log.WithFields(log.Fields{
			"action": actionName,
			"drop":   dropped,
			"var#":   varNum,
		}).Debug("Failed to load action definition file")
		return nil, dropped, fmt.Errorf("The marmots could not find the action definition file.\nPlease check your actions with [eris actions ls]")
	}

	log.WithField("file", strings.Join(actionName, "_")).Debug("Preparing to read action definition file")
	log.WithField("drop", dropped).Debug()

	var actionConf = viper.New()

	actionConf.AddConfigPath(dir.ActionsPath)
	actionConf.SetConfigName(strings.Join(actionName, "_"))
	err := actionConf.ReadInConfig()

	if err != nil {
		log.WithField("action", actionName[len(actionName)-1]).Debug("Dropping and retrying")
		dropped[fmt.Sprintf("$%d", varNum)] = actionName[len(actionName)-1]
		actionName = actionName[:len(actionName)-1]
		varNum++
		return readActionDefinition(actionName, dropped, varNum)
	} else {
		log.Debug("Successfully read action definition file")
	}

	return actionConf, dropped, nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:31,代码来源:load.go


示例2: TestRmChain

func TestRmChain(t *testing.T) {
	testStartChain(t, chainName)

	do := def.NowDo()
	do.Operations.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	log.WithField("=>", do.Name).Info("Removing keys (from tests)")
	if e := services.KillService(do); e != nil {
		tests.IfExit(e)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chainName, false, false
	log.WithField("=>", do.Name).Info("Stopping chain (from tests)")
	if e := KillChain(do); e != nil {
		tests.IfExit(e)
	}
	testExistAndRun(t, chainName, true, false)

	do = def.NowDo()
	do.Name = chainName
	do.RmD = true
	log.WithField("=>", do.Name).Info("Removing chain (from tests)")
	if e := RmChain(do); e != nil {
		tests.IfExit(e)
	}

	testExistAndRun(t, chainName, false, false)
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:28,代码来源:chains_test.go


示例3: StartServicesAndChains

func StartServicesAndChains(do *definitions.Do) error {
	// start the services and chains
	doSrvs := definitions.NowDo()
	if do.Action.Dependencies == nil || len(do.Action.Dependencies.Services) == 0 {
		log.Debug("No services to start")
	} else {
		doSrvs.Operations.Args = do.Action.Dependencies.Services
		log.WithField("args", doSrvs.Operations.Args).Debug("Starting services")
		if err := services.StartService(doSrvs); err != nil {
			return err
		}
	}

	doChns := definitions.NowDo()
	doChns.Name = do.Action.Chain
	if doChns.Name == "" {
		log.Debug("No chain to start")
	} else {
		log.WithField("=>", doChns.Name).Debug("Starting chain")
		if err := chains.StartChain(do); err != nil {
			return err
		}
	}

	return nil
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:26,代码来源:perform.go


示例4: RmData

// TODO: skip errors flag
func RmData(do *definitions.Do) (err error) {
	if len(do.Operations.Args) == 0 {
		do.Operations.Args = []string{do.Name}
	}
	for _, name := range do.Operations.Args {
		do.Name = name
		if util.IsDataContainer(do.Name, do.Operations.ContainerNumber) {
			log.WithField("=>", do.Name).Info("Removing data container")

			srv := definitions.BlankServiceDefinition()
			srv.Operations.SrvContainerName = util.ContainersName("data", do.Name, do.Operations.ContainerNumber)

			if err = perform.DockerRemove(srv.Service, srv.Operations, false, do.Volumes); err != nil {
				log.Errorf("Error removing %s: %v", do.Name, err)
				return err
			}

		} else {
			err = fmt.Errorf("I cannot find that data container for %s. Please check the data container name you sent me.", do.Name)
			log.Error(err)
			return err
		}

		if do.RmHF {
			log.WithField("=>", do.Name).Warn("Removing host directory")
			if err = os.RemoveAll(filepath.Join(DataContainersPath, do.Name)); err != nil {
				return err
			}
		}
	}

	do.Result = "success"
	return err
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:35,代码来源:manage.go


示例5: ListRunningOrExisting

// lists the containers running for a chain/service
// eventually remotes/actions
// existing -> true to ls existing; false to ls running
func ListRunningOrExisting(quiet, existing bool, typ string) (result string, err error) {
	re := "Running"
	if existing {
		re = "Existing"
	}
	log.WithField("status", strings.ToLower(re)).Debug("Asking Docker to list containers")
	//gotta go
	if quiet {
		if typ == "services" {
			result = strings.Join(util.ServiceContainerNames(existing), "\n")
		}
		if typ == "chains" {
			result = strings.Join(util.ChainContainerNames(existing), "\n")
		}
	} else {
		if typ == "services" {
			log.WithField("=>", fmt.Sprintf("service:%v", strings.ToLower(re))).Debug("Printing table")
			result, _ = PrintTableReport("service", existing, false) //false is for All, dealt with somewhere else
		}
		if typ == "chains" {
			log.WithField("=>", fmt.Sprintf("chain:%v", strings.ToLower(re))).Debugf("Printing table")
			result, _ = PrintTableReport("chain", existing, false)
		}
	}
	return result, nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:29,代码来源:listing_functions.go


示例6: DockerStop

// DockerStop stops a running ops.SrvContainerName container unforcedly.
// timeout is a number of seconds to wait before killing the container process
// ungracefully.
// It returns Docker errors on exit if not successful. DockerStop doesn't return
// an error if the container isn't running.
func DockerStop(srv *def.Service, ops *def.Operation, timeout uint) error {
	// don't limit this to verbose because it takes a few seconds
	// [zr] unless force sets timeout to 0 (for, eg. stdout)
	if timeout != 0 {
		log.WithField("=>", srv.Name).Warn("Stopping (may take a few seconds)")
	}

	log.WithFields(log.Fields{
		"=>":      ops.SrvContainerName,
		"timeout": timeout,
	}).Info("Stopping container")

	_, running := ContainerExists(ops)
	if running {
		log.WithField("=>", ops.SrvContainerName).Debug("Container found running")

		err := stopContainer(ops.SrvContainerName, timeout)
		if err != nil {
			return err
		}
	} else {
		log.WithField("=>", ops.SrvContainerName).Debug("Container found not running")
	}

	log.WithField("=>", ops.SrvContainerName).Info("Container stopped")

	return nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:33,代码来源:docker_run.go


示例7: createContainer

// ----------------------------------------------------------------------------
// ---------------------    Container Core ------------------------------------
// ----------------------------------------------------------------------------
func createContainer(opts docker.CreateContainerOptions) (*docker.Container, error) {
	dockerContainer, err := util.DockerClient.CreateContainer(opts)
	if err != nil {
		if err == docker.ErrNoSuchImage {
			if os.Getenv("ERIS_PULL_APPROVE") != "true" {
				var input string
				log.WithField("image", opts.Config.Image).Warn("The docker image not found locally")
				fmt.Print("Would you like the marmots to pull it from the repository? (y/n): ")
				fmt.Scanln(&input)

				if input == "Y" || input == "y" || input == "YES" || input == "Yes" || input == "yes" {
					log.Debug("User assented to pull")
				} else {
					log.Debug("User refused to pull")
					return nil, fmt.Errorf("Cannot start a container based on an image you will not let me pull.\n")
				}
			} else {
				log.WithField("image", opts.Config.Image).Warn("The Docker image is not found locally")
				log.Warn("The marmots are approved to pull it from the repository on your behalf")
				log.Warn("This could take a few minutes")
			}
			if err := pullImage(opts.Config.Image, nil); err != nil {
				return nil, err
			}
			dockerContainer, err = util.DockerClient.CreateContainer(opts)
			if err != nil {
				return nil, err
			}
		} else {
			return nil, err
		}
	}
	return dockerContainer, nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:37,代码来源:docker_run.go


示例8: testNumbersExistAndRun

//[zr] TODO move to testings package
func testNumbersExistAndRun(t *testing.T, servName string, containerExist, containerRun int) {
	log.WithFields(log.Fields{
		"=>":        servName,
		"existing#": containerExist,
		"running#":  containerRun,
	}).Info("Checking number of containers for")

	log.WithField("=>", servName).Debug("Checking existing containers for")
	exist := util.HowManyContainersExisting(servName, "service")

	log.WithField("=>", servName).Debug("Checking running containers for")
	run := util.HowManyContainersRunning(servName, "service")

	if exist != containerExist {
		log.WithFields(log.Fields{
			"name":     servName,
			"expected": containerExist,
			"got":      exist,
		}).Error("Wrong number of existing containers")
		fatal(t, nil)
	}

	if run != containerRun {
		log.WithFields(log.Fields{
			"name":     servName,
			"expected": containerExist,
			"got":      run,
		}).Error("Wrong number of running containers")
		fatal(t, nil)
	}

	log.Info("All good")
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:34,代码来源:clean_test.go


示例9: DockerExecData

// DockerExecData runs a data container with volumes-from field set interactively.
//
//  ops.Args         - command line parameters
//  ops.Interactive  - if true, set Entrypoint to ops.Args,
//                     if false, set Cmd to ops.Args
//
// See parameter description for DockerRunData.
func DockerExecData(ops *def.Operation, service *def.Service) (err error) {
	log.WithFields(log.Fields{
		"=>":   ops.DataContainerName,
		"args": ops.Args,
	}).Info("Executing data container")

	opts := configureVolumesFromContainer(ops, service)
	log.WithField("image", opts.Config.Image).Info("Data container configured")

	_, err = createContainer(opts)
	if err != nil {
		return err
	}

	// Clean up the container.
	defer func() {
		log.WithField("=>", opts.Name).Info("Removing data container")
		if err2 := removeContainer(opts.Name, true, false); err2 != nil {
			if os.Getenv("CIRCLE_BRANCH") == "" {
				err = fmt.Errorf("Tragic! Error removing data container after executing (%v): %v", err, err2)
			}
		}
		log.WithField("=>", opts.Name).Info("Data container removed")
	}()

	// Start the container.
	log.WithField("=>", opts.Name).Info("Executing interactive data container")
	if err = startInteractiveContainer(opts); err != nil {
		return err
	}

	return nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:40,代码来源:docker_run.go


示例10: ContainerDisassemble

func ContainerDisassemble(containerName string) *ContainerName {
	pop := strings.Split(containerName, "_")

	if len(pop) < 4 {
		log.WithField("=>", containerName).Debug("The marmots cannot disassemble container name")
		return &ContainerName{}
	}

	if !(pop[0] == "eris" || pop[0] == "/eris") {
		log.WithField("=>", containerName).Debug("The marmots cannot disassemble container name")
		return &ContainerName{}
	}

	typ := pop[1]
	srt := strings.Join(pop[2:len(pop)-1], "_")
	num, err := strconv.Atoi(pop[len(pop)-1])
	if err != nil {
		log.WithField("=>", containerName).Debug("The marmots cannot disassemble container name")

		return &ContainerName{}
	}

	// remove the leading slash docker adds
	containerName = strings.Replace(containerName, "/", "", 1)

	return &ContainerName{
		FullName:    containerName,
		DockersName: "/" + containerName,
		Type:        typ,
		Number:      num,
		ShortName:   srt,
	}
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:33,代码来源:container_info.go


示例11: TestKillRmService

func TestKillRmService(t *testing.T) {
	testStartService(t, servName, false)
	do := def.NowDo()
	do.Name = servName
	do.Rm = false
	do.RmD = false
	do.Operations.Args = []string{servName}
	log.WithField("=>", servName).Debug("Stopping service (from tests)")
	if e := KillService(do); e != nil {
		log.Error(e)
		tests.IfExit(e)
	}

	testExistAndRun(t, servName, 1, true, false)
	testNumbersExistAndRun(t, servName, 1, 0)

	if os.Getenv("TEST_IN_CIRCLE") == "true" {
		log.Warn("Testing in Circle where we don't have rm privileges. Skipping test")
		return
	}

	do = def.NowDo()
	do.Name = servName
	do.Operations.Args = []string{servName}
	do.File = false
	do.RmD = true
	log.WithField("=>", servName).Debug("Removing service (from tests)")
	if e := RmService(do); e != nil {
		log.Error(e)
		tests.IfExit(e)
	}

	testExistAndRun(t, servName, 1, false, false)
	testNumbersExistAndRun(t, servName, 0, 0)
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:35,代码来源:services_test.go


示例12: ChangeDirectory

func ChangeDirectory(to string) {
	if to == "bin" {
		erisLoc, err := exec.LookPath("eris")
		if err != nil {
			log.Fatalf("Error finding eris binary: %v", err)
		}
		err = os.Chdir(filepath.Dir(erisLoc))
		if err != nil {
			log.Fatalf("Error changing directory: %v", err)
		}
		log.WithField("dir", erisLoc).Debug("Directory changed to")
	} else if to == "src" {
		goPath := os.Getenv("GOPATH")
		if goPath == "" {
			log.Fatal("You do not have $GOPATH set. Please make sure this is set and rerun the command.")
		}

		dir := filepath.Join(goPath, "src", "github.com", "eris-ltd", "eris-cli")
		err := os.Chdir(dir)

		if err != nil {
			log.Fatalf("Error changing directory: %v")
		}
		log.WithField("dir", dir).Debug("Directory changed to")
	}
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:26,代码来源:update_tool.go


示例13: AutoMagic

// AutoMagic will return the highest container number which would represent the most recent
// container to work on unless newCont == true in which case it would return the highest
// container number plus one.
func AutoMagic(cNum int, typ string, newCont bool) int {
	log.WithField("automagic", cNum).Debug()
	contns := ErisContainersByType(typ, true)

	contnums := make([]int, len(contns))
	for i, c := range contns {
		contnums[i] = c.Number
	}

	// get highest container number
	g := 0
	for _, n := range contnums {
		if n >= g {
			g = n
		}
	}

	// ensure outcomes appropriate
	result := g
	if newCont {
		result = g + 1
	}
	if result == 0 {
		result = 1
	}

	log.WithField("automagic", result).Debug()

	return result
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:33,代码来源:container_operations.go


示例14: TestRmChain

func TestRmChain(t *testing.T) {
	start(t, chainName)

	do := def.NowDo()
	do.Operations.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	if err := services.KillService(do); err != nil {
		t.Fatalf("expected service to be stopped, got %v", err)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chainName, false, false
	log.WithField("=>", do.Name).Info("Stopping chain (from tests)")
	if err := KillChain(do); err != nil {
		t.Fatalf("expected chain to be stopped, got %v", err)
	}
	if n := util.HowManyContainersExisting(chainName, def.TypeChain); n != 1 {
		t.Fatalf("expecting 1 chain containers, got %v", n)
	}

	do = def.NowDo()
	do.Name = chainName
	do.RmD = true
	log.WithField("=>", do.Name).Info("Removing chain (from tests)")
	if err := RmChain(do); err != nil {
		t.Fatalf("expected chain to be removed, got %v", err)
	}
	if n := util.HowManyContainersExisting(chainName, def.TypeChain); n != 0 {
		t.Fatalf("expecting 0 chain containers, got %v", n)
	}
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:30,代码来源:chains_test.go


示例15: RenameAction

func RenameAction(do *definitions.Do) error {
	if do.Name == do.NewName {
		return fmt.Errorf("Cannot rename to same name")
	}

	do.Name = strings.Replace(do.Name, " ", "_", -1)
	do.NewName = strings.Replace(do.NewName, " ", "_", -1)
	act, _, err := LoadActionDefinition(do.Name)
	if err != nil {
		log.WithFields(log.Fields{
			"from": do.Name,
			"to":   do.NewName,
		}).Debug("Failed renaming action")
		return err
	}

	do.Name = strings.Replace(do.Name, " ", "_", -1)
	log.WithField("file", do.Name).Debug("Finding action definition file")
	oldFile := util.GetFileByNameAndType("actions", do.Name)
	if oldFile == "" {
		return fmt.Errorf("Could not find that action definition file.")
	}
	log.WithField("file", oldFile).Debug("Found action definition file")

	// if !strings.Contains(oldFile, ActionsPath) {
	// 	oldFile = filepath.Join(ActionsPath, oldFile) + ".toml"
	// }

	var newFile string
	newNameBase := strings.Replace(strings.Replace(do.NewName, " ", "_", -1), filepath.Ext(do.NewName), "", 1)

	if newNameBase == do.Name {
		newFile = strings.Replace(oldFile, filepath.Ext(oldFile), filepath.Ext(do.NewName), 1)
	} else {
		newFile = strings.Replace(oldFile, do.Name, do.NewName, 1)
		newFile = strings.Replace(newFile, " ", "_", -1)
	}

	if newFile == oldFile {
		log.Info("Not renaming the same file")
		return nil
	}

	act.Name = strings.Replace(newNameBase, "_", " ", -1)

	log.WithFields(log.Fields{
		"old": act.Name,
		"new": newFile,
	}).Debug("Writing new action definition file")
	err = WriteActionDefinitionFile(act, newFile)
	if err != nil {
		return err
	}

	log.WithField("file", oldFile).Debug("Removing old file")
	os.Remove(oldFile)

	return nil
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:59,代码来源:manage.go


示例16: ImportData

// ImportData does what it says. It imports from a host's Source to a Dest
// in a data container. It returns an error.
//
//  do.Name                       - name of the data container to use (required)
//  do.Operations.ContainerNumber - container number (optional)
//  do.Source                     - directory which should be imported (required)
//  do.Destination                - directory to _unload_ the payload into (required)
//
func ImportData(do *definitions.Do) error {
	log.WithFields(log.Fields{
		"from": do.Source,
		"to":   do.Destination,
	}).Debug("Importing")
	if util.IsDataContainer(do.Name, do.Operations.ContainerNumber) {

		srv := PretendToBeAService(do.Name, do.Operations.ContainerNumber)
		service, exists := perform.ContainerExists(srv.Operations)

		if !exists {
			return fmt.Errorf("There is no data container for that service.")
		}
		if err := checkErisContainerRoot(do, "import"); err != nil {
			return err
		}

		containerName := util.DataContainersName(do.Name, do.Operations.ContainerNumber)
		os.Chdir(do.Source)

		reader, err := util.Tar(do.Source, 0)
		if err != nil {
			return err
		}
		defer reader.Close()

		opts := docker.UploadToContainerOptions{
			InputStream:          reader,
			Path:                 do.Destination,
			NoOverwriteDirNonDir: true,
		}

		log.WithField("=>", containerName).Info("Copying into container")
		log.WithField("path", do.Source).Debug()
		if err := util.DockerClient.UploadToContainer(service.ID, opts); err != nil {
			return err
		}

		doChown := definitions.NowDo()
		doChown.Operations.DataContainerName = containerName
		doChown.Operations.ContainerType = "data"
		doChown.Operations.ContainerNumber = do.Operations.ContainerNumber
		//required b/c `docker cp` (UploadToContainer) goes in as root
		doChown.Operations.Args = []string{"chown", "--recursive", "eris", do.Destination}
		_, err = perform.DockerRunData(doChown.Operations, nil)
		if err != nil {
			return fmt.Errorf("Error changing owner: %v\n", err)
		}
	} else {
		log.WithField("name", do.Name).Info("Data container does not exist.")
		ops := loaders.LoadDataDefinition(do.Name, do.Operations.ContainerNumber)
		if err := perform.DockerCreateData(ops); err != nil {
			return fmt.Errorf("Error creating data container %v.", err)
		}
		return ImportData(do)
	}
	do.Result = "success"
	return nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:67,代码来源:operate.go


示例17: CheckoutBranch

func CheckoutBranch(branch string) {
	checkoutArgs := []string{"checkout", branch}

	stdOut, err := exec.Command("git", checkoutArgs...).CombinedOutput()
	if err != nil {
		log.WithField("branch", branch).Fatalf("Error checking out branch: %v", string(stdOut))
	}

	log.WithField("branch", branch).Debug("Branch checked-out")
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:10,代码来源:update_tool.go


示例18: StartGroup

// start a group of chains or services. catch errors on a channel so we can stop as soon as something goes wrong
func StartGroup(group []*definitions.ServiceDefinition) error {
	log.WithField("services#", len(group)).Debug("Starting services group")
	for _, srv := range group {
		log.WithField("=>", srv.Name).Debug("Performing container start")
		if err := perform.DockerRunService(srv.Service, srv.Operations); err != nil {
			return fmt.Errorf("StartGroup. Err starting srv =>\t%s:%v\n", srv.Name, err)
		}
	}
	return nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:11,代码来源:operate.go


示例19: getMachineDeets

func getMachineDeets(machName string) (string, string, error) {
	var out = new(bytes.Buffer)
	var out2 = new(bytes.Buffer)

	noConnectError := fmt.Errorf("Could not evaluate the env vars for the %s docker-machine.\n", machName)
	dHost, dPath := popHostAndPath()

	if (dHost != "" && dPath != "") && (machName == "eris" || machName == "default") {
		return dHost, dPath, nil
	}

	// TODO: when go-dockerclient adds machine API endpoints use those instead.
	log.WithField("machine", machName).Debug("Querying Docker Machine URL")
	cmd := exec.Command("docker-machine", "url", machName)
	cmd.Stdout = out
	if err := cmd.Run(); err != nil {
		return "", "", fmt.Errorf("%vError:\t%v\n", noConnectError, err)
	}
	dHost = strings.TrimSpace(out.String())
	log.WithField("host", dHost).Debug()

	// TODO: when go-dockerclient adds machine API endpoints use those instead.
	log.WithField("machine", machName).Debug("Querying Docker Machine cert path")
	cmd2 := exec.Command("docker-machine", "inspect", machName, "--format", "{{.HostOptions.AuthOptions.ServerCertPath}}")
	cmd2.Stdout = out2
	//cmd2.Stderr = os.Stderr
	if err := cmd2.Run(); err != nil {
		return "", "", fmt.Errorf("%vError:\t%v\n", noConnectError, err)
	}
	dPath = out2.String()
	dPath = strings.Replace(dPath, "'", "", -1)
	dPath = filepath.Dir(dPath)
	log.WithField("cert path", dPath).Debug()

	if dPath == "" || dHost == "" {
		return "", "", noConnectError
	}

	log.Info("Querying host and user have access to the right files for TLS connection to Docker")
	if err := checkKeysAndCerts(dPath); err != nil {
		return "", "", err
	}
	log.Debug("Certificate files look good")

	// technically, do not *have* to do this, but it will make repetitive tasks faster
	log.Debug("Setting environment variables for quick future development")
	os.Setenv("DOCKER_HOST", dHost)
	os.Setenv("DOCKER_CERT_PATH", dPath)
	os.Setenv("DOCKER_TLS_VERIFY", "1")
	os.Setenv("DOCKER_MACHINE_NAME", machName)

	log.WithField("machine", machName).Debug("Finished getting machine details")
	return dHost, dPath, nil
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:54,代码来源:docker_client.go


示例20: FindChainContainer

func FindChainContainer(name string, number int, running bool) *ContainerName {
	for _, srv := range ChainContainers(running) {
		if srv.ShortName == name {
			if srv.Number == number {
				log.WithField("match", fmt.Sprintf("%s:%d", srv.ShortName, srv.Number)).Debug("Found chain container")
				return srv
			}
		}
	}
	log.WithField("=>", fmt.Sprintf("%s:%d", name, number)).Info("Could not find chain container")
	return nil
}
开发者ID:mxjxn,项目名称:eris-cli,代码行数:12,代码来源:container_info.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang logrus.WithFields函数代码示例发布时间:2022-05-23
下一篇:
Golang logrus.Warn函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap