本文整理汇总了Golang中github.com/prometheus/prometheus/util/cli.Term.Errorf方法的典型用法代码示例。如果您正苦于以下问题:Golang Term.Errorf方法的具体用法?Golang Term.Errorf怎么用?Golang Term.Errorf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/prometheus/prometheus/util/cli.Term
的用法示例。
在下文中一共展示了Term.Errorf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CheckConfigCmd
// CheckConfigCmd validates configuration files.
func CheckConfigCmd(t cli.Term, args ...string) int {
if len(args) == 0 {
t.Infof("usage: promtool check-config <files>")
return 2
}
failed := false
for _, arg := range args {
ruleFiles, err := checkConfig(t, arg)
if err != nil {
t.Errorf(" FAILED: %s", err)
failed = true
} else {
t.Infof(" SUCCESS: %d rule files found", len(ruleFiles))
}
t.Infof("")
for _, rf := range ruleFiles {
if n, err := checkRules(t, rf); err != nil {
t.Errorf(" FAILED: %s", err)
failed = true
} else {
t.Infof(" SUCCESS: %d rules found", n)
}
t.Infof("")
}
}
if failed {
return 1
}
return 0
}
示例2: DumpHeadsCmd
// DumpHeadsCmd dumps metadata of a heads.db file.
func DumpHeadsCmd(t cli.Term, args ...string) int {
if len(args) != 1 {
t.Infof("usage: storagetool dump-heads <file>")
return 2
}
if err := local.DumpHeads(args[0], t.Out()); err != nil {
t.Errorf(" FAILED: %s", err)
return 1
}
return 0
}
示例3: CheckRulesCmd
// CheckRulesCmd validates rule files.
func CheckRulesCmd(t cli.Term, args ...string) int {
if len(args) == 0 {
t.Infof("usage: promtool check-rules <files>")
return 2
}
failed := false
for _, arg := range args {
if n, err := checkRules(t, arg); err != nil {
t.Errorf(" FAILED: %s", err)
failed = true
} else {
t.Infof(" SUCCESS: %d rules found", n)
}
t.Infof("")
}
if failed {
return 1
}
return 0
}