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


Golang cmd.Colorfy函數代碼示例

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


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

示例1: saveBootData

func saveBootData(boot *BootOpts, blog string, elapsed time.Duration) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(boot.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(elapsed.String(), "green", "", "bold"),
		cmd.Colorfy(blog, "yellow", "", ""))
	return nil
}
開發者ID:vijaykanthm28,項目名稱:gulp,代碼行數:7,代碼來源:boot.go

示例2: setProvisioner

//this is an array, a property provider helps to load the provider specific stuff
func (s *Service) setProvisioner(pt string) error {
	var err error
	var tempProv provision.Provisioner

	if tempProv, err = provision.Get(pt); err != nil {
		return err
	}
	log.Debugf(cmd.Colorfy("  > configuring ", "blue", "", "bold") + fmt.Sprintf("%s ", pt))
	if initializableProvisioner, ok := tempProv.(provision.InitializableProvisioner); ok {
		err = initializableProvisioner.Initialize(s.Dockerd.toMap(), s.Bridges.ConvertToMap())
		if err != nil {
			return fmt.Errorf("unable to initialize %s provisioner\n --> %s", pt, err)
		} else {
			log.Debugf(cmd.Colorfy(fmt.Sprintf("  > %s initialized", pt), "blue", "", "bold"))
		}
	}

	if messageProvisioner, ok := tempProv.(provision.MessageProvisioner); ok {
		startupMessage, err := messageProvisioner.StartupMessage()
		if err == nil && startupMessage != "" {
			log.Infof(startupMessage)
		}
	}

	carton.ProvisionerMap[pt] = tempProv
	return nil
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:28,代碼來源:service.go

示例3: saveDeployData

func saveDeployData(opts *StateOpts, dlog string, duration time.Duration) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(opts.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(duration.String(), "green", "", "bold"),
		cmd.Colorfy(dlog, "yellow", "", ""))
	return nil
}
開發者ID:vijaykanthm28,項目名稱:gulp,代碼行數:7,代碼來源:state.go

示例4: saveUpgradeData

func saveUpgradeData(opts *Upgradeable, ulog string, duration time.Duration) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(opts.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(duration.String(), "green", "", "bold"),
		cmd.Colorfy(ulog, "yellow", "", ""))
	return nil
}
開發者ID:rajthilakmca,項目名稱:gulp,代碼行數:7,代碼來源:upgrade.go

示例5: saveStateData

func saveStateData(opts *StateChangeOpts, slog string, duration time.Duration, changeError error) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(opts.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(duration.String(), "green", "", "bold"),
		cmd.Colorfy(slog, "yellow", "", ""))

	if opts.B.Level == provision.BoxSome && opts.B.Repo.IsEnabled() {
		hookId, err := repository.Manager(opts.B.Repo.GetSource()).CreateHook(opts.B.Repo)
		if err != nil {
			return nil
		}

		comp, err := NewComponent(opts.B.Id)
		if err != nil {
			return err
		}

		if err = comp.setDeployData(DeployData{
			Timestamp: time.Now(),
			Duration:  duration,
			HookId:    hookId,
		}); err != nil {
			return err
		}
	}
	return nil
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:27,代碼來源:state.go

示例6: Initialize

//initialize the provisioner and setup the requirements for provisioner
func (p *chefsoloProvisioner) Initialize(m map[string]string) error {
	var outBuffer bytes.Buffer
	start := time.Now()

	p.Cookbook = m[CHEFREPO_COOKBOOK]
	logWriter := carton.NewLogWriter(&provision.Box{CartonName: m[NAME]})
	writer := io.MultiWriter(&outBuffer, &logWriter)
	defer logWriter.Close()

	cr := NewChefRepo(m, writer)
	if err := cr.Download(true); err != nil {
		err = provision.EventNotify(constants.StatusCookbookFailure)
		return err
	}
	if err := cr.Torr(); err != nil {
		err = provision.EventNotify(constants.StatusCookbookFailure)
		return err
	}
	elapsed := time.Since(start)

	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(m[NAME], "cyan", "", "bold"),
		cmd.Colorfy(elapsed.String(), "green", "", "bold"),
		cmd.Colorfy(outBuffer.String(), "yellow", "", ""))
	_ = provision.EventNotify(constants.StatusCookbookSuccess)
	return nil
}
開發者ID:rajthilakmca,項目名稱:gulp,代碼行數:28,代碼來源:provisioner.go

示例7: saveDeployData

func saveDeployData(opts *DeployOpts, imageId, dlog string, duration time.Duration, deployError error) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(opts.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(duration.String(), "green", "", "bold"),
		cmd.Colorfy(dlog, "yellow", "", ""))
	//if there are deployments to track as follows in outputs: {} then do it here.
	//Riak: code to save the status of a deploy (created.)
	// deploy :
	//     name:
	//     status:

	/*deploy := DeployData {
		App:       opts.App.Name,
		Timestamp: time.Now(),
		Duration:  duration,
		Commit:    opts.Commit,
		Image:     imageId,
		Log:       log,
	}
	if opts.Commit != "" {
		deploy.Origin = "git"
	} else if opts.Image != "" {
		deploy.Origin = "rollback"
	} else {
		deploy.Origin = "app-deploy"
	}
	if deployError != nil {
		deploy.Error = deployError.Error()
	}
	return db.Store(compid or assmid, &struct)
	*/
	return nil
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:33,代碼來源:deploy.go

示例8: saveLifecycleData

func saveLifecycleData(li *LifecycleOpts, llog string, elapsed time.Duration) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(li.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(elapsed.String(), "green", "", "bold"),
		cmd.Colorfy(llog, "yellow", "", ""))
	return nil
}
開發者ID:vijaykanthm28,項目名稱:gulp,代碼行數:7,代碼來源:lifecycle.go

示例9: StartupMessage

func (p *dockerProvisioner) StartupMessage() (string, error) {
	w := new(tabwriter.Writer)
	var b bytes.Buffer
	w.Init(&b, 0, 8, 0, '\t', 0)
	b.Write([]byte(cmd.Colorfy("  > docker ", "white", "", "bold") + "\t" +
		cmd.Colorfy(p.String(), "cyan", "", "")))
	fmt.Fprintln(w)
	w.Flush()
	return strings.TrimSpace(b.String()), nil
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:10,代碼來源:provisioner.go

示例10: saveDestroyedData

func saveDestroyedData(opts *DestroyOpts, slog string, duration time.Duration, destroyError error) error {
	log.Debugf("%s in (%s)\n%s",
		cmd.Colorfy(opts.B.GetFullName(), "cyan", "", "bold"),
		cmd.Colorfy(duration.String(), "green", "", "bold"),
		cmd.Colorfy(slog, "yellow", "", ""))
	if destroyError == nil {
		markDeploysAsRemoved(opts)
	}
	return nil
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:10,代碼來源:destroyer.go

示例11: Call

func (c *Rpc) Call(command string, args []interface{}) ([]interface{}, error) {
	log.Debugf(cmd.Colorfy("  > [one-go] ", "blue", "", "bold")+"%s", command)
	log.Debugf(cmd.Colorfy("\n> args   ", "cyan", "", "bold")+" %v\n", args)

	result := []interface{}{}
	if err := c.Client.Call(command, args, &result); err != nil {
		return nil, err
	}
	//log.Debugf(cmd.Colorfy("\n> response ", "cyan", "", "bold")+" %v", result)
	log.Debugf(cmd.Colorfy("  > [one-go] ( ´ ▽ ` ) SUCCESS", "blue", "", "bold"))
	return result, nil
}
開發者ID:rajthilakmca,項目名稱:opennebula-go,代碼行數:12,代碼來源:api.go

示例12: String

func (c Config) String() string {
	w := new(tabwriter.Writer)
	var b bytes.Buffer
	w.Init(&b, 0, 8, 0, '\t', 0)
	b.Write([]byte(cmd.Colorfy("Config:", "white", "", "bold") + "\t" +
		cmd.Colorfy("httpd", "green", "", "") + "\n"))
	b.Write([]byte("Enabled" + "\t" + strconv.FormatBool(c.Enabled) + "\n"))
	b.Write([]byte("BindAddress" + "\t" + c.BindAddress + "\n"))
	fmt.Fprintln(w)
	w.Flush()
	return b.String()
}
開發者ID:vijaykanthm28,項目名稱:gulp,代碼行數:12,代碼來源:config.go

示例13: String

func (d DockerBridge) String() string {
	w := new(tabwriter.Writer)
	var b bytes.Buffer
	w.Init(&b, 1, 8, 0, '\t', 0)
	b.Write([]byte(cmd.Colorfy("Bridge", "white", "", "") + "\t" +
		cmd.Colorfy(d.Name, "blue", "", "") + "\n"))
	b.Write([]byte("network" + "\t" + d.Network + "\n"))
	b.Write([]byte("gateway" + "\t" + d.Gateway + "\n"))
	b.Write([]byte("---\n"))
	fmt.Fprintln(w)
	w.Flush()
	return strings.TrimSpace(b.String())
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:13,代碼來源:config_bridges.go

示例14: String

func (c Config) String() string {
	w := new(tabwriter.Writer)
	var b bytes.Buffer
	w.Init(&b, 0, 8, 0, '\t', 0)
	b.Write([]byte(cmd.Colorfy("Config:", "white", "", "bold") + "\t" +
		cmd.Colorfy("Metricsd", "cyan", "", "") + "\n"))
	b.Write([]byte("enabled" + "\t" + strconv.FormatBool(c.Enabled) + "\n"))
	b.Write([]byte("collect_interval" + "\t" + c.CollectInterval.String() + "\n"))
	b.Write([]byte("---\n"))
	fmt.Fprintln(w)
	w.Flush()
	return strings.TrimSpace(b.String())
}
開發者ID:vijaykanthm28,項目名稱:vertice,代碼行數:13,代碼來源:config.go

示例15: NewRPCClient

/**
 *
 * Creates an RPCClient with endpoint and returns it
 *
 **/
func NewRPCClient(endpoint string, username string, password string) (*Rpc, error) {
	log.Debugf(cmd.Colorfy("  > [one-go] connecting", "blue", "", "bold"))

	RPCclient, err := xmlrpc.NewClient(endpoint, nil)

	if err != nil {
		//TO-DO: trap and send connRefused error.
		return nil, err
	}
	log.Debugf(cmd.Colorfy("  > [one-go] connected", "blue", "", "bold")+" %s", endpoint)

	return &Rpc{
		RPCClient: *RPCclient,
		Key:       username + ":" + password}, nil
}
開發者ID:morpheyesh,項目名稱:goca,代碼行數:20,代碼來源:api.go


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