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

Golang log.Debug函数代码示例

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

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



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

示例1: Create

func (d *Driver) Create() error {
	if err := d.setUserSubscription(); err != nil {
		return err
	}

	log.Info("Creating Azure machine...")
	vmConfig, err := vmClient.CreateAzureVMConfiguration(d.MachineName, d.Size, d.Image, d.Location)
	if err != nil {
		return err
	}

	log.Debug("Generating certificate for Azure...")
	if err := d.generateCertForAzure(); err != nil {
		return err
	}

	log.Debug("Adding Linux provisioning...")
	vmConfig, err = vmClient.AddAzureLinuxProvisioningConfig(vmConfig, d.GetSSHUsername(), d.UserPassword, d.azureCertPath(), d.SSHPort)
	if err != nil {
		return err
	}

	log.Debug("Authorizing ports...")
	if err := d.addDockerEndpoints(vmConfig); err != nil {
		return err
	}

	log.Debug("Creating VM...")
	if err := vmClient.CreateAzureVM(vmConfig, d.MachineName, d.Location); err != nil {
		return err
	}

	return nil
}
开发者ID:robebeye,项目名称:machine,代码行数:34,代码来源:azure.go


示例2: TestIntegrationLogs

func TestIntegrationLogs(t *testing.T) {

	logsLastH := getLogs(t, "LAST_HOUR")
	logsLast24H := getLogs(t, "LAST_24H")
	logsLast7D := getLogs(t, "LAST_7D")
	logsLast30D := getLogs(t, "LAST_30D")
	logsLast365D := getLogs(t, "LAST_365D")

	for index, _ := range logsLastH {
		assert.Equal(t, logsLastH[index].Id, logsLast24H[index].Id)
		assert.Equal(t, logsLastH[index].Id, logsLast7D[index].Id)
		assert.Equal(t, logsLastH[index].Id, logsLast30D[index].Id)
		assert.Equal(t, logsLastH[index].Id, logsLast365D[index].Id)
	}

	for index, _ := range logsLast24H {
		assert.Equal(t, logsLast24H[index].Id, logsLast7D[index].Id)
		assert.Equal(t, logsLast24H[index].Id, logsLast30D[index].Id)
		assert.Equal(t, logsLast24H[index].Id, logsLast365D[index].Id)
	}

	for index, _ := range logsLast7D {
		assert.Equal(t, logsLast7D[index].Id, logsLast30D[index].Id)
		assert.Equal(t, logsLast7D[index].Id, logsLast365D[index].Id)
	}

	for index, _ := range logsLast30D {
		assert.Equal(t, logsLast30D[index].Id, logsLast365D[index].Id)
	}

	var i = 0
	for index, _ := range logsLast7D {
		i++
		if i == 60 {
			break
		}
		cLog, err := GetAPI().GetLog(logsLast7D[index].Id)
		log.Debug(logsLast7D[index])
		log.Debug(cLog)

		assert.Nil(t, err)
		assert.Equal(t, logsLast7D[index].Id, cLog.Id)
		assert.Equal(t, logsLast7D[index].StartDate, cLog.StartDate)
		assert.Equal(t, logsLast7D[index].EndDate, cLog.EndDate)
		assert.Equal(t, logsLast7D[index].Duration, cLog.Duration)
		assert.Equal(t, logsLast7D[index].Status.Percent, cLog.Status.Percent)
		assert.Equal(t, logsLast7D[index].Status.State, cLog.Status.State)
		assert.Equal(t, logsLast7D[index].Action, cLog.Action)
		assert.Equal(t, logsLast7D[index].Type, cLog.Type)
		assert.Equal(t, logsLast7D[index].Resource.Id, cLog.Resource.Id)
		assert.Equal(t, logsLast7D[index].Resource.Name, cLog.Resource.Name)
		assert.Equal(t, logsLast7D[index].User.Id, cLog.User.Id)
		assert.Equal(t, logsLast7D[index].User.Name, cLog.User.Name)
		assert.Equal(t, logsLast7D[index].CloudPanelId, cLog.CloudPanelId)

		time.Sleep(1 * time.Second)
	}
}
开发者ID:Noxaro,项目名称:oneandone-cloudserver-api-integrative-tests,代码行数:58,代码来源:logs_test.go


示例3: hostOnlyIpAvailable

func (d *Driver) hostOnlyIpAvailable() bool {
	ip, err := d.GetIP()
	if err != nil {
		log.Debug("ERROR getting IP: %s", err)
		return false
	}
	if ip != "" {
		log.Debugf("IP is %s", ip)
		return true
	}
	log.Debug("Strangely, there was no error attempting to get the IP, but it was still empty.")
	return false
}
开发者ID:Kast0rTr0y,项目名称:docker-machine,代码行数:13,代码来源:virtualbox.go


示例4: NewClient

func NewClient(user string, host string, port int, auth *Auth) (Client, error) {
	sshBinaryPath, err := exec.LookPath("ssh")
	if err != nil {
		log.Debug("SSH binary not found, using native Go implementation")
		return NewNativeClient(user, host, port, auth)
	}

	if defaultClientType == Native {
		log.Debug("Using SSH client type: native")
		return NewNativeClient(user, host, port, auth)
	}

	log.Debug("Using SSH client type: external")
	return NewExternalClient(sshBinaryPath, user, host, port, auth)
}
开发者ID:jkingyens,项目名称:machine,代码行数:15,代码来源:client.go


示例5: awsApiCall

func (e *EC2) awsApiCall(v url.Values) (*http.Response, error) {
	v.Set("Version", "2014-06-15")
	log.Debug("Making AWS API call with values:")
	utils.DumpVal(v)
	client := &http.Client{}
	finalEndpoint := fmt.Sprintf("%s?%s", e.Endpoint, v.Encode())
	req, err := http.NewRequest("GET", finalEndpoint, nil)
	if err != nil {
		return &http.Response{}, fmt.Errorf("error creating request from client")
	}
	req.Header.Add("Content-type", "application/json")

	awsauth.Sign4(req, awsauth.Credentials{
		AccessKeyID:     e.Auth.AccessKey,
		SecretAccessKey: e.Auth.SecretKey,
		SecurityToken:   e.Auth.SessionToken,
	})
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("client encountered error while doing the request: %s", err.Error())
		return resp, fmt.Errorf("client encountered error while doing the request: %s", err)
	}

	if resp.StatusCode != http.StatusOK {
		return resp, newAwsApiResponseError(*resp)
	}
	return resp, nil
}
开发者ID:sdgdsffdsfff,项目名称:dockerf,代码行数:28,代码来源:ec2.go


示例6: GetIP

func (d *Driver) GetIP() (string, error) {
	// DHCP is used to get the IP, so virtualbox hosts don't have IPs unless
	// they are running
	s, err := d.GetState()
	if err != nil {
		return "", err
	}
	if s != state.Running {
		return "", drivers.ErrHostIsNotRunning
	}

	sshClient, err := d.getLocalSSHClient()
	if err != nil {
		return "", err
	}

	output, err := sshClient.Output("ip addr show dev eth1")
	if err != nil {
		log.Debug(output)
		return "", err
	}

	log.Debugf("SSH returned: %s\nEND SSH\n", output)

	// parse to find: inet 192.168.59.103/24 brd 192.168.59.255 scope global eth1
	lines := strings.Split(output, "\n")
	for _, line := range lines {
		vals := strings.Split(strings.TrimSpace(line), " ")
		if len(vals) >= 2 && vals[0] == "inet" {
			return vals[1][:strings.Index(vals[1], "/")], nil
		}
	}

	return "", fmt.Errorf("No IP address found %s", output)
}
开发者ID:phusl,项目名称:machine,代码行数:35,代码来源:virtualbox.go


示例7: sshAvailableFunc

func sshAvailableFunc(d Driver) func() bool {
	return func() bool {
		log.Debug("Getting to WaitForSSH function...")
		hostname, err := d.GetSSHHostname()
		if err != nil {
			log.Debugf("Error getting IP address waiting for SSH: %s", err)
			return false
		}
		port, err := d.GetSSHPort()
		if err != nil {
			log.Debugf("Error getting SSH port: %s", err)
			return false
		}
		if err := ssh.WaitForTCP(fmt.Sprintf("%s:%d", hostname, port)); err != nil {
			log.Debugf("Error waiting for TCP waiting for SSH: %s", err)
			return false
		}

		if _, err := RunSSHCommandFromDriver(d, "exit 0"); err != nil {
			log.Debugf("Error getting ssh command 'exit 0' : %s", err)
			return false
		}
		return true
	}
}
开发者ID:cdosso,项目名称:machine,代码行数:25,代码来源:utils.go


示例8: Provision

func (provisioner *DebianProvisioner) Provision(swarmOptions swarm.SwarmOptions, authOptions auth.AuthOptions, engineOptions engine.EngineOptions) error {
	provisioner.SwarmOptions = swarmOptions
	provisioner.AuthOptions = authOptions
	provisioner.EngineOptions = engineOptions

	if provisioner.EngineOptions.StorageDriver == "" {
		provisioner.EngineOptions.StorageDriver = "aufs"
	}

	// HACK: since debian does not come with sudo by default we install
	log.Debug("installing sudo")
	if _, err := provisioner.SSHCommand("if ! type sudo; then apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo; fi"); err != nil {
		return err
	}

	log.Debug("setting hostname")
	if err := provisioner.SetHostname(provisioner.Driver.GetMachineName()); err != nil {
		return err
	}

	log.Debug("installing base packages")
	for _, pkg := range provisioner.Packages {
		if err := provisioner.Package(pkg, pkgaction.Install); err != nil {
			return err
		}
	}

	log.Debug("installing docker")
	if err := installDockerGeneric(provisioner, engineOptions.InstallURL); err != nil {
		return err
	}

	log.Debug("waiting for docker daemon")
	if err := utils.WaitFor(provisioner.dockerDaemonResponding); err != nil {
		return err
	}

	provisioner.AuthOptions = setRemoteAuthOptions(provisioner)

	log.Debug("configuring auth")
	if err := ConfigureAuth(provisioner); err != nil {
		return err
	}

	log.Debug("configuring swarm")
	if err := configureSwarm(provisioner, swarmOptions, provisioner.AuthOptions); err != nil {
		return err
	}

	// enable in systemd
	log.Debug("enabling docker in systemd")
	if err := provisioner.Service("docker", serviceaction.Enable); err != nil {
		return err
	}

	return nil
}
开发者ID:justintung,项目名称:machine,代码行数:57,代码来源:debian.go


示例9: Restart

func (d *Driver) Restart() error {
	log.Debug("Restarting...")

	if _, err := drivers.RunSSHCommandFromDriver(d, "sudo shutdown -r now"); err != nil {
		return err
	}

	return nil
}
开发者ID:cdosso,项目名称:machine,代码行数:9,代码来源:generic.go


示例10: Kill

func (d *Driver) Kill() error {
	log.Debug("Killing...")

	if _, err := drivers.RunSSHCommandFromDriver(d, "sudo shutdown -P now"); err != nil {
		return err
	}

	return nil
}
开发者ID:cdosso,项目名称:machine,代码行数:9,代码来源:generic.go


示例11: DumpVal

func DumpVal(vals ...interface{}) {
	for _, val := range vals {
		prettyJSON, err := json.MarshalIndent(val, "", "    ")
		if err != nil {
			log.Fatal(err)
		}
		log.Debug(string(prettyJSON))
	}
}
开发者ID:weiwongfaye,项目名称:learn_go,代码行数:9,代码来源:utils.go


示例12: installOfficialDocker

func (provisioner *RedHatProvisioner) installOfficialDocker() error {
	log.Debug("installing docker")

	if _, err := provisioner.SSHCommand(fmt.Sprintf("sudo yum install -y --nogpgcheck  %s", provisioner.DockerRPMPath)); err != nil {
		return err
	}

	return nil
}
开发者ID:cdosso,项目名称:machine,代码行数:9,代码来源:redhat.go


示例13: GetDvdIso

// GET /dvd_isos/{id}
func (api *API) GetDvdIso(Id string) (*DvdIso, error) {
	log.Debug("requesting information about dvd iso", Id)
	result := new(DvdIso)
	err := api.Client.Get(createUrl(api, "dvd_isos", Id), &result, http.StatusOK)
	if err != nil {
		return nil, err
	}
	result.api = api
	return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:dvdisos.go


示例14: CreateServer

// POST /servers
func (api *API) CreateServer(configuration ServerCreateData) (*Server, error) {
	log.Debug("requesting to create a new server")
	result := new(Server)
	err := api.Client.Post(createUrl(api, "servers"), &configuration, &result, http.StatusAccepted)
	if err != nil {
		return nil, err
	}
	result.api = api
	return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:servers.go


示例15: Shell

func (client ExternalClient) Shell() error {
	cmd := exec.Command(client.BinaryPath, client.BaseArgs...)
	log.Debug(cmd)

	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr

	return cmd.Run()
}
开发者ID:jkingyens,项目名称:machine,代码行数:10,代码来源:client.go


示例16: securityGroupAvailableFunc

func (d *Driver) securityGroupAvailableFunc(id string) func() bool {
	return func() bool {
		_, err := d.getClient().GetSecurityGroupById(id)
		if err == nil {
			return true
		}
		log.Debug(err)
		return false
	}
}
开发者ID:cdosso,项目名称:machine,代码行数:10,代码来源:amazonec2.go


示例17: GetServerAppliance

// GET /server_appliances/{id}
func (api *API) GetServerAppliance(Id string) (*ServerAppliance, error) {
	log.Debug("requesting information about server appliance", Id)
	res := new(ServerAppliance)
	err := api.Client.Get(createUrl(api, "server_appliances", Id), &res, http.StatusOK)
	if err != nil {
		return nil, err
	}
	res.api = api
	return res, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:serverappliances.go


示例18: Delete

// DELETE /firewall_policies/{id}
func (fwp *FirewallPolicy) Delete() (*FirewallPolicy, error) {
	log.Debug("Requested to delete firewall policy ", fwp.Id)
	result := new(FirewallPolicy)
	err := fwp.api.Client.Delete(createUrl(fwp.api, "firewall_policies", fwp.Id), &result, http.StatusAccepted)
	if err != nil {
		return nil, err
	}
	result.api = fwp.api
	return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:firewallpolicies.go


示例19: GetServer

// GET /servers/{id}
func (api *API) GetServer(Id string) (*Server, error) {
	log.Debug("requesting information about server ", Id)
	result := new(Server)
	err := api.Client.Get(createUrl(api, "servers", Id), &result, http.StatusOK)
	if err != nil {
		return nil, err
	}
	result.api = api
	return result, nil
}
开发者ID:shing19m,项目名称:oneandone-cloudserver-api,代码行数:11,代码来源:servers.go


示例20: instanceIsRunning

func (d *Driver) instanceIsRunning() bool {
	st, err := d.GetState()
	if err != nil {
		log.Debug(err)
	}
	if st == state.Running {
		return true
	}
	return false
}
开发者ID:cdosso,项目名称:machine,代码行数:10,代码来源:amazonec2.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang log.Debugf函数代码示例发布时间:2022-05-23
下一篇:
Golang swarm.Options类代码示例发布时间: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