本文整理汇总了Golang中github.com/youtube/vitess/go/vt/logutil.Logger.Printf方法的典型用法代码示例。如果您正苦于以下问题:Golang Logger.Printf方法的具体用法?Golang Logger.Printf怎么用?Golang Logger.Printf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/logutil.Logger
的用法示例。
在下文中一共展示了Logger.Printf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewSplitStrategy
func NewSplitStrategy(logger logutil.Logger, argsStr string) (*SplitStrategy, error) {
var args []string
if argsStr != "" {
args = strings.Split(argsStr, " ")
}
flagSet := flag.NewFlagSet("strategy", flag.ContinueOnError)
flagSet.SetOutput(logutil.NewLoggerWriter(logger))
flagSet.Usage = func() {
logger.Printf("Strategy flag has the following options:\n")
flagSet.PrintDefaults()
}
populateBlpCheckpoint := flagSet.Bool("populate_blp_checkpoint", false, "populates the blp checkpoint table")
dontStartBinlogPlayer := flagSet.Bool("dont_start_binlog_player", false, "do not start the binlog player after restore is complete")
skipSetSourceShards := flagSet.Bool("skip_set_source_shards", false, "do not set the SourceShar field on destination shards")
if err := flagSet.Parse(args); err != nil {
return nil, fmt.Errorf("cannot parse strategy: %v", err)
}
if flagSet.NArg() > 0 {
return nil, fmt.Errorf("strategy doesn't have positional arguments")
}
return &SplitStrategy{
PopulateBlpCheckpoint: *populateBlpCheckpoint,
DontStartBinlogPlayer: *dontStartBinlogPlayer,
SkipSetSourceShards: *skipSetSourceShards,
}, nil
}
示例2: printUpdatedThrottlers
func printUpdatedThrottlers(logger logutil.Logger, server string, names []string) {
table := tablewriter.NewWriter(loggerWriter{logger})
table.SetAutoFormatHeaders(false)
table.SetHeader([]string{"Name"})
for _, name := range names {
table.Append([]string{name})
}
table.Render()
logger.Printf("%d active throttler(s) on server '%v' were updated.\n", len(names), server)
}
示例3: PrintAllCommands
// PrintAllCommands prints a help text for all registered commands to the given Logger.
func PrintAllCommands(logger logutil.Logger) {
for _, group := range commands {
if group.Name == "Debugging" {
continue
}
logger.Printf("%v: %v\n", group.Name, group.Description)
for _, cmd := range group.Commands {
logger.Printf(" %v %v\n", cmd.Name, cmd.Params)
}
logger.Printf("\n")
}
}