本文整理汇总了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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()
}
示例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())
}
示例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())
}
示例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
}