當前位置: 首頁>>代碼示例>>Golang>>正文


Golang glog.Infof函數代碼示例

本文整理匯總了Golang中github.com/barakmich/glog.Infof函數的典型用法代碼示例。如果您正苦於以下問題:Golang Infof函數的具體用法?Golang Infof怎麽用?Golang Infof使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Infof函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ExecInput

func (s *Session) ExecInput(input string, c chan interface{}, _ int) {
	defer close(c)
	var mqlQuery interface{}
	err := json.Unmarshal([]byte(input), &mqlQuery)
	if err != nil {
		return
	}
	s.currentQuery = NewQuery(s)
	s.currentQuery.BuildIteratorTree(mqlQuery)
	if s.currentQuery.isError() {
		return
	}
	it, _ := s.currentQuery.it.Optimize()
	if glog.V(2) {
		b, err := json.MarshalIndent(it.Describe(), "", "  ")
		if err != nil {
			glog.Infof("failed to format description: %v", err)
		} else {
			glog.Infof("%s", b)
		}
	}
	for graph.Next(it) {
		tags := make(map[string]graph.Value)
		it.TagResults(tags)
		c <- tags
		for it.NextPath() == true {
			tags := make(map[string]graph.Value)
			it.TagResults(tags)
			c <- tags
		}
	}
}
開發者ID:ericcapricorn,項目名稱:cayley,代碼行數:32,代碼來源:session.go

示例2: LogRequest

func LogRequest(handler ResponseHandler) httprouter.Handle {
	return func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
		start := time.Now()
		addr := req.Header.Get("X-Real-IP")
		if addr == "" {
			addr = req.Header.Get("X-Forwarded-For")
			if addr == "" {
				addr = req.RemoteAddr
			}
		}
		glog.Infof("Started %s %s for %s", req.Method, req.URL.Path, addr)
		code := handler(w, req, params)
		glog.Infof("Completed %v %s %s in %v", code, http.StatusText(code), req.URL.Path, time.Since(start))

	}
}
開發者ID:SunSparc,項目名稱:cayley,代碼行數:16,代碼來源:http.go

示例3: materializeSet

func (it *Materialize) materializeSet() {
	i := 0
	for graph.Next(it.subIt) {
		i++
		if i > abortMaterializeAt {
			it.aborted = true
			break
		}
		id := it.subIt.Result()
		val := id
		if h, ok := id.(Keyer); ok {
			val = h.Key()
		}
		if _, ok := it.containsMap[val]; !ok {
			it.containsMap[val] = len(it.values)
			it.values = append(it.values, nil)
		}
		index := it.containsMap[val]
		tags := make(map[string]graph.Value)
		it.subIt.TagResults(tags)
		it.values[index] = append(it.values[index], result{id: id, tags: tags})
		for it.subIt.NextPath() {
			tags := make(map[string]graph.Value)
			it.subIt.TagResults(tags)
			it.values[index] = append(it.values[index], result{id: id, tags: tags})
		}
	}
	if it.aborted {
		it.values = nil
		it.containsMap = nil
		it.subIt.Reset()
	}
	glog.Infof("Materialization List %d: %#v", it.values)
	it.hasRun = true
}
開發者ID:jacqui,項目名稱:cayley,代碼行數:35,代碼來源:materialize_iterator.go

示例4: runIterator

func (wk *worker) runIterator(it graph.Iterator) {
	if wk.wantShape() {
		iterator.OutputQueryShapeForIterator(it, wk.qs, wk.shape)
		return
	}
	it, _ = it.Optimize()
	if glog.V(2) {
		b, err := json.MarshalIndent(it.Describe(), "", "  ")
		if err != nil {
			glog.Infof("failed to format description: %v", err)
		} else {
			glog.Infof("%s", b)
		}
	}
	for {
		select {
		case <-wk.kill:
			return
		default:
		}
		if !graph.Next(it) {
			break
		}
		tags := make(map[string]graph.Value)
		it.TagResults(tags)
		if !wk.send(&Result{actualResults: tags}) {
			break
		}
		for it.NextPath() {
			select {
			case <-wk.kill:
				return
			default:
			}
			tags := make(map[string]graph.Value)
			it.TagResults(tags)
			if !wk.send(&Result{actualResults: tags}) {
				break
			}
		}
	}
	if glog.V(2) {
		bytes, _ := json.MarshalIndent(graph.DumpStats(it), "", "  ")
		glog.V(2).Infoln(string(bytes))
	}
	it.Close()
}
開發者ID:ericcapricorn,項目名稱:cayley,代碼行數:47,代碼來源:finals.go

示例5: Serve

func Serve(handle *graph.Handle, cfg *config.Config) {
	SetupRoutes(handle, cfg)
	glog.Infof("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort)
	fmt.Printf("Cayley now listening on http://%s:%s\n", cfg.ListenHost, cfg.ListenPort)
	err := http.ListenAndServe(fmt.Sprintf("%s:%s", cfg.ListenHost, cfg.ListenPort), nil)
	if err != nil {
		glog.Fatal("ListenAndServe: ", err)
	}
}
開發者ID:SunSparc,項目名稱:cayley,代碼行數:9,代碼來源:http.go

示例6: OpenQuadWriter

func OpenQuadWriter(qs graph.QuadStore, cfg *config.Config) (graph.QuadWriter, error) {
	glog.Infof("Opening replication method %q", cfg.ReplicationType)
	w, err := graph.NewQuadWriter(cfg.ReplicationType, qs, cfg.ReplicationOptions)
	if err != nil {
		return nil, err
	}

	return w, nil
}
開發者ID:oliverp19,項目名稱:cayley,代碼行數:9,代碼來源:db.go

示例7: OpenQuadStore

func OpenQuadStore(cfg *config.Config) (graph.QuadStore, error) {
	glog.Infof("Opening quad store %q at %s", cfg.DatabaseType, cfg.DatabasePath)
	qs, err := graph.NewQuadStore(cfg.DatabaseType, cfg.DatabasePath, cfg.DatabaseOptions)
	if err != nil {
		return nil, err
	}

	return qs, nil
}
開發者ID:oliverp19,項目名稱:cayley,代碼行數:9,代碼來源:db.go

示例8: Open

func Open(cfg *config.Config) (graph.TripleStore, error) {
	glog.Infof("Opening database %q at %s", cfg.DatabaseType, cfg.DatabasePath)
	ts, err := graph.NewTripleStore(cfg.DatabaseType, cfg.DatabasePath, cfg.DatabaseOptions)
	if err != nil {
		return nil, err
	}

	return ts, nil
}
開發者ID:uriencedric,項目名稱:cayley,代碼行數:9,代碼來源:db.go

示例9: CayleyHTTP

func CayleyHTTP(ts graph.TripleStore, cfg *config.CayleyConfig) {
	SetupRoutes(ts, cfg)
	glog.Infof("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort)
	fmt.Printf("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort)
	err := http.ListenAndServe(fmt.Sprintf("%s:%s", cfg.ListenHost, cfg.ListenPort), nil)
	if err != nil {
		glog.Fatal("ListenAndServe: ", err)
	}
}
開發者ID:java10000,項目名稱:cayley,代碼行數:9,代碼來源:cayley_http.go

示例10: Open

func Open(cfg *config.Config) graph.TripleStore {
	glog.Infof("Opening database \"%s\" at %s", cfg.DatabaseType, cfg.DatabasePath)
	switch cfg.DatabaseType {
	case "mongo", "mongodb":
		return mongo.NewTripleStore(cfg.DatabasePath, cfg.DatabaseOptions)
	case "leveldb":
		return leveldb.NewTripleStore(cfg.DatabasePath, cfg.DatabaseOptions)
	case "mem":
		ts := memstore.NewTripleStore()
		Load(ts, cfg, cfg.DatabasePath, true)
		return ts
	}
	panic("Unsupported database backend " + cfg.DatabaseType)
}
開發者ID:heshizhu,項目名稱:cayley,代碼行數:14,代碼來源:open.go

示例11: OpenTSFromConfig

func OpenTSFromConfig(config *cfg.CayleyConfig) graph.TripleStore {
	glog.Infof("Opening database \"%s\" at %s", config.DatabaseType, config.DatabasePath)
	switch config.DatabaseType {
	case "mongo", "mongodb":
		return graph_mongo.NewMongoTripleStore(config.DatabasePath, config.DatabaseOptions)
	case "leveldb":
		return graph_leveldb.NewDefaultLevelDBTripleStore(config.DatabasePath, config.DatabaseOptions)
	case "mem":
		ts := graph_memstore.NewMemTripleStore()
		CayleyLoad(ts, config, config.DatabasePath, true)
		return ts
	}
	panic("Unsupported database backend " + config.DatabaseType)
}
開發者ID:JIVS,項目名稱:cayley,代碼行數:14,代碼來源:cayley-open.go

示例12: Open

func Open(cfg *config.Config) (graph.TripleStore, error) {
	glog.Infof("Opening database \"%s\" at %s", cfg.DatabaseType, cfg.DatabasePath)
	ts, err := graph.NewTripleStore(cfg.DatabaseType, cfg.DatabasePath, cfg.DatabaseOptions)
	if err != nil {
		return nil, err
	}

	// Memstore is not persistent, so it MUST be loaded.
	if cfg.DatabaseType == "memstore" {
		err = Load(ts, cfg, cfg.DatabasePath)
		if err != nil {
			return nil, err
		}
	}

	return ts, nil
}
開發者ID:henfee,項目名稱:cayley,代碼行數:17,代碼來源:open.go

示例13: printIterator

func printIterator(qs graph.QuadStore, it graph.Iterator) {
	for graph.Next(it) {
		glog.Infof("%v", qs.Quad(it.Result()))
	}
}
開發者ID:lytics,項目名稱:cayley,代碼行數:5,代碼來源:quadstore_test.go


注:本文中的github.com/barakmich/glog.Infof函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。