当前位置: 首页>>代码示例>>Golang>>正文


Golang log.Fatalf函数代码示例

本文整理汇总了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)
}
开发者ID:rochacon,项目名称:tsuru,代码行数:11,代码来源:provisioner.go

示例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)
	}
}
开发者ID:rochacon,项目名称:tsuru,代码行数:11,代码来源:queue.go

示例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())
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:9,代码来源:provisioner.go

示例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
}
开发者ID:rochacon,项目名称:tsuru,代码行数:8,代码来源:queue.go

示例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)
	}
}
开发者ID:tmosleyIII,项目名称:gandalf,代码行数:44,代码来源:main.go


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