本文整理汇总了Golang中github.com/tsuru/tsuru/log.Fatalf函数的典型用法代码示例。如果您正苦于以下问题:Golang Fatalf函数的具体用法?Golang Fatalf怎么用?Golang Fatalf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fatalf函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: unitsCollection
func (p *JujuProvisioner) unitsCollection() *storage.Collection {
name, err := config.GetString("juju:units-collection")
if err != nil {
log.Fatalf("FATAL: %s.", err)
}
conn, err := db.Conn()
if err != nil {
log.Fatalf("Failed to connect to the database: %s", err)
}
return conn.Collection(name)
}
示例2: setQueue
func setQueue() {
var err error
qfactory, err = queue.Factory()
if err != nil {
log.Fatalf("Failed to get the queue instance: %s", err)
}
_handler, err = qfactory.Handler(handle, queueName)
if err != nil {
log.Fatalf("Failed to create the queue handler: %s", err)
}
}
示例3: Provision
// Provision creates a route for the container
func (p *dockerProvisioner) Provision(app provision.App) error {
r, err := getRouterForApp(app)
if err != nil {
log.Fatalf("Failed to get router: %s", err)
return err
}
return r.AddBackend(app.GetName())
}
示例4: getQueue
func getQueue(name string) queue.Q {
o.Do(setQueue)
q, err := qfactory.Get(name)
if err != nil {
log.Fatalf("Failed to get queue %q: %s", name, err)
}
return q
}
示例5: main
func main() {
dry := flag.Bool("dry", false, "dry-run: does not start the server (for testing purpose)")
configFile := flag.String("config", "/etc/gandalf.conf", "Gandalf configuration file")
gVersion := flag.Bool("version", false, "Print version and exit")
flag.Parse()
if *gVersion {
fmt.Printf("gandalf-webserver version %s\n", version)
return
}
log.Debugf("Opening config file: %s ...\n", *configFile)
err := config.ReadAndWatchConfigFile(*configFile)
if err != nil {
msg := `Could not open gandalf config file at %s (%s).
For an example, see: gandalf/etc/gandalf.conf
Note that you can specify a different config file with the --config option -- e.g.: --config=./etc/gandalf.conf`
log.Fatalf(msg, *configFile, err)
}
log.Init()
log.Debugf("Successfully read config file: %s\n", *configFile)
router := api.SetupRouter()
n := negroni.New()
n.Use(api.NewLoggerMiddleware())
n.Use(api.NewResponseHeaderMiddleware("Server", "gandalf-webserver/"+version))
n.Use(api.NewResponseHeaderMiddleware("Cache-Control", "private, max-age=0"))
n.Use(api.NewResponseHeaderMiddleware("Expires", "-1"))
n.UseHandler(router)
bind, err := config.GetString("bind")
if err != nil {
var perr error
bind, perr = config.GetString("webserver:port")
if perr != nil {
panic(err)
}
}
if !*dry {
bareLocation, err := config.GetString("git:bare:location")
if err != nil {
panic("You should configure a git:bare:location for gandalf.")
}
fmt.Printf("Repository location: %s\n", bareLocation)
fmt.Printf("gandalf-webserver %s listening on %s\n", version, bind)
http.ListenAndServe(bind, router)
}
}