當前位置: 首頁>>代碼示例>>Golang>>正文


Golang log.Debug函數代碼示例

本文整理匯總了Golang中github.com/docker/machine/log.Debug函數的典型用法代碼示例。如果您正苦於以下問題:Golang Debug函數的具體用法?Golang Debug怎麽用?Golang Debug使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Debug函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/docker/machine/log.Debug函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。