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

Golang cmd.Colorfy函数代码示例

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

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



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


示例16: logs

func logs(w http.ResponseWriter, r *http.Request) error {
	conn, err := upgrader.Upgrade(w, r, nil)
	if err != nil {
		log.Errorf("Error in socket connection")
		return err
	}
	messageType, p, err := conn.ReadMessage()

	if err != nil {
		return err
	}

	var entry provision.Box

	_ = json.Unmarshal(p, &entry)

	l, _ := provision.NewLogListener(&entry)

	go func() {
		if _, _, err := conn.NextReader(); err != nil {
			conn.Close()
			l.Close()
			log.Debugf(cmd.Colorfy("  > [nsqd] unsub   ", "blue", "", "bold") + fmt.Sprintf("Unsubscribing from the Queue"))
		}
	}()

	for log := range l.B {
		logData, _ := json.Marshal(log)
		go conn.WriteMessage(messageType, logData)
	}

	return nil
}
开发者ID:vijaykanthm28,项目名称:vertice,代码行数:33,代码来源:box.go


示例17: 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("Meta", "cyan", "", "") + "\n"))
	b.Write([]byte("Home      " + "\t" + c.Home + "\n"))
	b.Write([]byte("Dir       " + "\t" + c.Dir + "\n"))
	b.Write([]byte("Riak      " + "\t" + strings.Join(c.Riak, ",") + "\n"))
	b.Write([]byte("Api       " + "\t" + c.Api + "\n"))
	b.Write([]byte("NSQd      " + "\t" + strings.Join(c.NSQd, ",") + "\n"))
	b.Write([]byte("---\n"))
	fmt.Fprintln(w)
	w.Flush()
	return strings.TrimSpace(b.String())
}
开发者ID:vijaykanthm28,项目名称:vertice,代码行数:16,代码来源:config.go


示例18: String

func (w *WrappedParms) String() string {
	wt := new(tabwriter.Writer)
	var b bytes.Buffer
	wt.Init(&b, 0, 8, 0, '\t', 0)
	b.Write([]byte(cmd.Colorfy("Packages", "cyan", "", "") + "\n"))
	for _, v := range w.Packages {
		b.Write([]byte(v + "\n"))
	}
	b.Write([]byte(cmd.Colorfy("Options", "blue", "", "") + "\n"))
	for k, v := range w.Options {
		b.Write([]byte(k + "\t" + v + "\n"))
	}
	b.Write([]byte("---\n"))
	fmt.Fprintln(wt)
	wt.Flush()
	return strings.TrimSpace(b.String())
}
开发者ID:rajthilakmca,项目名称:megdc,代码行数:17,代码来源:wrappedparms.go


示例19: connectToKeySpace

// Connect to a certain keyspace directly. Same as using Connect().KeySpace(keySpaceName)
func connectToKeySpace(keySpace string, nodeIps []string, username, password string) (gocassa.KeySpace, error) {
	c, err := gocassa.Connect(nodeIps, username, password)
	if err != nil {
		return nil, err
	}
	log.Debugf(cmd.Colorfy("  > [scylla] keyspace "+keySpace, "blue", "", "bold"))
	return c.KeySpace(keySpace), nil
}
开发者ID:vijaykanthm28,项目名称:libgo,代码行数:9,代码来源:scylladb.go


示例20: Accept

func (p *ReqOperator) Accept(r *MegdProcessor) error {
	c, err := p.Get(p.Id)
	if err != nil {
		return err
	}
	md := *r
	log.Debugf(cmd.Colorfy(md.String(), "cyan", "", "bold"))
	return md.Process(c)
}
开发者ID:vijaykanthm28,项目名称:vertice,代码行数:9,代码来源:req_operator.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang db.Conn函数代码示例发布时间:2022-05-23
下一篇:
Golang action.NewPipeline函数代码示例发布时间: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