• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang glog.Fatalln函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/barakmich/glog.Fatalln函数的典型用法代码示例。如果您正苦于以下问题:Golang Fatalln函数的具体用法?Golang Fatalln怎么用?Golang Fatalln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Fatalln函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: configFrom

func configFrom(file string) *config.Config {
	// Find the file...
	if file != "" {
		if _, err := os.Stat(file); os.IsNotExist(err) {
			glog.Fatalln("Cannot find specified configuration file", file, ", aborting.")
		}
	} else if _, err := os.Stat(os.Getenv("CAYLEY_CFG")); err == nil {
		file = os.Getenv("CAYLEY_CFG")
	} else if _, err := os.Stat("/etc/cayley.cfg"); err == nil {
		file = "/etc/cayley.cfg"
	}
	if file == "" {
		glog.Infoln("Couldn't find a config file in either $CAYLEY_CFG or /etc/cayley.cfg. Going by flag defaults only.")
	}
	cfg, err := config.Load(file)
	if err != nil {
		glog.Fatalln(err)
	}
	if cfg.DatabasePath == "" {
		cfg.DatabasePath = *databasePath
	}

	if cfg.DatabaseType == "" {
		cfg.DatabaseType = *databaseBackend
	}
	return cfg
}
开发者ID:e4x,项目名称:cayley,代码行数:27,代码来源:cayleyupgrade.go


示例2: init

func init() {
	glog.SetToStderr(true)
	cfg, err := configFrom("cayley_appengine.cfg")
	if err != nil {
		glog.Fatalln("Error loading config:", err)
	}

	handle, err := db.Open(cfg)
	if err != nil {
		glog.Fatalln("Error opening database:", err)
	}
	http.SetupRoutes(handle, cfg)
}
开发者ID:lytics,项目名称:cayley,代码行数:13,代码来源:appengine.go


示例3: ReadTriplesFromFile

func ReadTriplesFromFile(c chan *graph.Triple, tripleFile string) {
	f, err := os.Open(tripleFile)
	if err != nil {
		glog.Fatalln("Couldn't open file", tripleFile)
	}

	defer func() {
		if err := f.Close(); err != nil {
			glog.Fatalln(err)
		}
	}()

	nquads.ReadNQuadsFromReader(c, f)
}
开发者ID:java10000,项目名称:cayley,代码行数:14,代码来源:appengine.go


示例4: ReadNQuadsFromReader

func ReadNQuadsFromReader(c chan *graph.Triple, reader io.Reader) {
	bf := bufio.NewReader(reader)

	nTriples := 0
	line := ""
	for {
		l, pre, err := bf.ReadLine()
		if err == io.EOF {
			break
		}
		if err != nil {
			glog.Fatalln("Something bad happened while reading file " + err.Error())
		}
		line += string(l)
		if pre {
			continue
		}
		triple := Parse(line)
		line = ""
		if triple != nil {
			nTriples++
			c <- triple
		}
	}
	glog.Infoln("Read", nTriples, "triples")
	close(c)
}
开发者ID:ZSIT,项目名称:cayley,代码行数:27,代码来源:nquads.go


示例5: ParseConfigFromFile

func ParseConfigFromFile(filename string) *CayleyConfig {
	config := &CayleyConfig{}
	if filename == "" {
		return config
	}
	f, err := os.Open(filename)
	if err != nil {
		glog.Fatalln("Couldn't open config file", filename)
	}

	defer f.Close()

	dec := json.NewDecoder(f)
	err = dec.Decode(config)
	if err != nil {
		glog.Fatalln("Couldn't read config file:", err)
	}
	return config
}
开发者ID:JIVS,项目名称:cayley,代码行数:19,代码来源:cayley-config.go


示例6: findAssetsPath

func findAssetsPath() string {
	if *assetsPath != "" {
		if hasAssets(*assetsPath) {
			return *assetsPath
		}
		glog.Fatalln("Cannot find assets at", *assetsPath, ".")
	}

	if hasAssets(".") {
		return "."
	}

	gopathPath := os.ExpandEnv("$GOPATH/src/github.com/google/cayley")
	if hasAssets(gopathPath) {
		return gopathPath
	}
	glog.Fatalln("Cannot find assets in any of the default search paths. Please run in the same directory, in a Go workspace, or set --assets .")
	panic("cannot reach")
}
开发者ID:ericcapricorn,项目名称:cayley,代码行数:19,代码来源:http.go


示例7: ParseConfigFromFlagsAndFile

func ParseConfigFromFlagsAndFile(fileFlag string) *Config {
	// Find the file...
	var trueFilename string
	if fileFlag != "" {
		if _, err := os.Stat(fileFlag); os.IsNotExist(err) {
			glog.Fatalln("Cannot find specified configuration file", fileFlag, ", aborting.")
		} else {
			trueFilename = fileFlag
		}
	} else {
		if _, err := os.Stat(os.Getenv("CAYLEY_CFG")); err == nil {
			trueFilename = os.Getenv("CAYLEY_CFG")
		} else {
			if _, err := os.Stat("/etc/cayley.cfg"); err == nil {
				trueFilename = "/etc/cayley.cfg"
			}
		}
	}
	if trueFilename == "" {
		glog.Infoln("Couldn't find a config file in either $CAYLEY_CFG or /etc/cayley.cfg. Going by flag defaults only.")
	}
	config := ParseConfigFromFile(trueFilename)

	if config.DatabasePath == "" {
		config.DatabasePath = *databasePath
	}

	if config.DatabaseType == "" {
		config.DatabaseType = *databaseBackend
	}

	if config.ReplicationType == "" {
		config.ReplicationType = *replicationBackend
	}

	if config.ListenHost == "" {
		config.ListenHost = *host
	}

	if config.ListenPort == "" {
		config.ListenPort = *port
	}

	if config.Timeout == 0 {
		config.Timeout = *timeout
	}

	if config.LoadSize == 0 {
		config.LoadSize = *loadSize
	}

	config.ReadOnly = config.ReadOnly || *readOnly

	return config
}
开发者ID:kris-lab,项目名称:cayley,代码行数:55,代码来源:config.go


示例8: GetIntKey

func (d OptionsDict) GetIntKey(key string) (int, bool) {
	if val, ok := d[key]; ok {
		switch vv := val.(type) {
		case float64:
			return int(vv), true
		default:
			glog.Fatalln("Invalid", key, "parameter type from config.")
		}
	}
	return 0, false
}
开发者ID:jandersen,项目名称:cayley,代码行数:11,代码来源:triplestore.go


示例9: GetStringKey

func (d OptionsDict) GetStringKey(key string) (string, bool) {
	if val, ok := d[key]; ok {
		switch vv := val.(type) {
		case string:
			return vv, true
		default:
			glog.Fatalln("Invalid", key, "parameter type from config.")
		}
	}
	return "", false
}
开发者ID:jandersen,项目名称:cayley,代码行数:11,代码来源:triplestore.go


示例10: BoolKey

func (d Options) BoolKey(key string) (bool, bool) {
	if val, ok := d[key]; ok {
		switch vv := val.(type) {
		case bool:
			return vv, true
		default:
			glog.Fatalln("Invalid", key, "parameter type from config.")
		}
	}
	return false, false
}
开发者ID:JesseLivingston,项目名称:cayley,代码行数:11,代码来源:quadstore.go


示例11: ServeV1WriteNQuad

func (api *API) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params httprouter.Params) int {
	if api.config.ReadOnly {
		return jsonResponse(w, 400, "Database is read-only.")
	}

	formFile, _, err := r.FormFile("NQuadFile")
	if err != nil {
		glog.Errorln(err)
		return jsonResponse(w, 500, "Couldn't read file: "+err.Error())
	}
	defer formFile.Close()

	blockSize, blockErr := strconv.ParseInt(r.URL.Query().Get("block_size"), 10, 64)
	if blockErr != nil {
		blockSize = int64(api.config.LoadSize)
	}

	quadReader, err := internal.Decompressor(formFile)
	// TODO(kortschak) Make this configurable from the web UI.
	dec := cquads.NewDecoder(quadReader)

	h, err := api.GetHandleForRequest(r)
	if err != nil {
		return jsonResponse(w, 400, err)
	}

	var (
		n     int
		block = make([]quad.Quad, 0, blockSize)
	)
	for {
		t, err := dec.Unmarshal()
		if err != nil {
			if err == io.EOF {
				break
			}
			glog.Fatalln("what can do this here?", err) // FIXME(kortschak)
		}
		block = append(block, t)
		n++
		if len(block) == cap(block) {
			h.QuadWriter.AddQuadSet(block)
			block = block[:0]
		}
	}
	h.QuadWriter.AddQuadSet(block)

	fmt.Fprintf(w, "{\"result\": \"Successfully wrote %d quads.\"}", n)

	return 200
}
开发者ID:lytics,项目名称:cayley,代码行数:51,代码来源:write.go


示例12: Load

func Load(ts graph.TripleStore, cfg *config.Config, path string) error {
	f, err := os.Open(path)
	if err != nil {
		return fmt.Errorf("could not open file %q: %v", path, err)
	}
	defer f.Close()

	r, err := decompressor(f)
	if err != nil {
		glog.Fatalln(err)
	}

	dec := cquads.NewDecoder(r)

	bulker, canBulk := ts.(graph.BulkLoader)
	if canBulk {
		err = bulker.BulkLoad(dec)
		if err == nil {
			return nil
		}
		if err == graph.ErrCannotBulkLoad {
			err = nil
		}
	}
	if err != nil {
		return err
	}

	block := make([]*quad.Quad, 0, cfg.LoadSize)
	for {
		t, err := dec.Unmarshal()
		if err != nil {
			if err == io.EOF {
				break
			}
			return err
		}
		block = append(block, t)
		if len(block) == cap(block) {
			ts.AddTripleSet(block)
			block = block[:0]
		}
	}
	ts.AddTripleSet(block)

	return nil
}
开发者ID:neevor,项目名称:cayley,代码行数:47,代码来源:load.go


示例13: main

func main() {
	// No command? It's time for usage.
	if len(os.Args) == 1 {
		Usage()
		os.Exit(1)
	}

	cmd := os.Args[1]
	var newargs []string
	newargs = append(newargs, os.Args[0])
	newargs = append(newargs, os.Args[2:]...)
	os.Args = newargs
	flag.Parse()

	var buildString string
	if VERSION != "" {
		buildString = fmt.Sprint("Cayley ", VERSION, " built ", BUILD_DATE)
		glog.Infoln(buildString)
	}

	cfg := config.ParseConfigFromFlagsAndFile(*configFile)

	if os.Getenv("GOMAXPROCS") == "" {
		runtime.GOMAXPROCS(runtime.NumCPU())
		glog.Infoln("Setting GOMAXPROCS to", runtime.NumCPU())
	} else {
		glog.Infoln("GOMAXPROCS currently", os.Getenv("GOMAXPROCS"), " -- not adjusting")
	}

	var (
		ts  graph.TripleStore
		err error
	)
	switch cmd {
	case "version":
		if VERSION != "" {
			fmt.Println(buildString)
		} else {
			fmt.Println("Cayley snapshot")
		}
		os.Exit(0)
	case "init":
		err = db.Init(cfg, *tripleFile)
	case "load":
		ts, err = db.Open(cfg)
		if err != nil {
			break
		}
		err = db.Load(ts, cfg, *tripleFile)
		if err != nil {
			break
		}
		ts.Close()
	case "repl":
		ts, err = db.Open(cfg)
		if err != nil {
			break
		}
		err = db.Repl(ts, *queryLanguage, cfg)
		if err != nil {
			break
		}
		ts.Close()
	case "http":
		ts, err = db.Open(cfg)
		if err != nil {
			break
		}
		http.Serve(ts, cfg)
		ts.Close()
	default:
		fmt.Println("No command", cmd)
		flag.Usage()
	}
	if err != nil {
		glog.Fatalln(err)
	}
}
开发者ID:jacqui,项目名称:cayley,代码行数:78,代码来源:cayley.go


示例14: Result

func (it *AllIterator) Result() graph.Value {
	if it.result == nil {
		glog.Fatalln("result was nil", it)
	}
	return it.result
}
开发者ID:e4x,项目名称:cayley,代码行数:6,代码来源:all_iterator.go


示例15: main

func main() {
	// No command? It's time for usage.
	if len(os.Args) == 1 {
		Usage()
		os.Exit(1)
	}

	cmd := os.Args[1]
	newargs := make([]string, 0)
	newargs = append(newargs, os.Args[0])
	newargs = append(newargs, os.Args[2:]...)
	os.Args = newargs
	flag.Parse()

	cfg := config.ParseConfigFromFlagsAndFile(*configFile)

	if os.Getenv("GOMAXPROCS") == "" {
		runtime.GOMAXPROCS(runtime.NumCPU())
		glog.Infoln("Setting GOMAXPROCS to", runtime.NumCPU())
	} else {
		glog.Infoln("GOMAXPROCS currently", os.Getenv("GOMAXPROCS"), " -- not adjusting")
	}

	var (
		ts  graph.TripleStore
		err error
	)
	switch cmd {
	case "init":
		err = db.Init(cfg, *tripleFile)
	case "load":
		ts, err = db.Open(cfg)
		if err != nil {
			break
		}
		err = db.Load(ts, cfg, *tripleFile)
		if err != nil {
			break
		}
		ts.Close()
	case "repl":
		ts, err = db.Open(cfg)
		if err != nil {
			break
		}
		err = db.Repl(ts, *queryLanguage, cfg)
		if err != nil {
			break
		}
		ts.Close()
	case "http":
		ts, err = db.Open(cfg)
		if err != nil {
			break
		}
		http.Serve(ts, cfg)
		ts.Close()
	default:
		fmt.Println("No command", cmd)
		flag.Usage()
	}
	if err != nil {
		glog.Fatalln(err)
	}
}
开发者ID:henfee,项目名称:cayley,代码行数:65,代码来源:cayley.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang glog.Infof函数代码示例发布时间:2022-05-24
下一篇:
Golang glog.Errorln函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap