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


Golang log4go.Fine函數代碼示例

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


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

示例1: RunClang

func RunClang(args ...string) ([]byte, error) {
	cmd := exec.Command("clang", args...)
	log4go.Debug("Running clang command: %v", cmd)

	if e, err := cmd.StderrPipe(); err != nil {
		return nil, err
	} else if s, err := cmd.StdoutPipe(); err != nil {
		return nil, err
	} else if err := cmd.Start(); err != nil {
		return nil, err
	} else {
		so, serr := ioutil.ReadAll(s)
		eo, eerr := ioutil.ReadAll(e)
		// We ignore the output error here as a non-zero exit
		// code doesn't necessarily mean that the output isn't
		// useful
		cmd.Wait()

		log4go.Fine("stdout: %s\n", string(so))
		log4go.Fine("stderr: %s\n", string(eo))
		if serr != nil {
			return nil, serr
		} else if eerr != nil {
			return nil, eerr
		}
		return so, nil
	}
}
開發者ID:jerchung,項目名稱:completion,代碼行數:28,代碼來源:clang.go

示例2: Complete

func (c *Java) Complete(args *content.CompleteArgs, cmp *content.CompletionResult) error {
	log4go.Fine("%+v", args)
	var archive Archive
	session := args.Session()
	if session != nil {
		if a, ok := session.Get("java_archive").(Archive); ok {
			archive = a
		}
	}
	if archive == nil {
		cp, err := DefaultClasspath()
		if err != nil {
			// We don't really care about not being able to get the default classpath as it could be provided manually by the user
			log4go.Warn("Couldn't get the default classpath: %s", err)
		}
		settings := args.Settings()
		if cp2, ok := settings.Get("java_classpath").([]string); ok {
			// TODO: do we ever want to override rather than append to the classpath?
			cp = append(cp, cp2...)
		}
		log4go.Fine("classpath: %+v", cp)
		if archive, err = NewCompositeArchive(cp); err != nil {
			return err
		} else if session != nil {
			session.Set("java_archive", archive)
		}
	}

	className, err := fqnToClassname(args.Location)
	if err != nil {
		return err
	}

	data, err := archive.LoadClass(className)
	if err != nil {
		return err
	}

	class, err := NewClass(bytes.NewReader(data))
	if err != nil {
		return err
	}

	ct, err := class.ToContentType()
	if err != nil {
		return err
	}

	// TODO(q): Inherited fields and methods?
	// 			I see value in being able to "just" get the smaller set,
	//			but getting the full set should definitely be possible "server side"
	cmp.Fields = ct.Fields
	cmp.Types = ct.Types
	cmp.Methods = ct.Methods

	return nil
}
開發者ID:NeoTse,項目名稱:completion,代碼行數:57,代碼來源:java.go

示例3: Call

func (qe QueryContextEvent) Call(v *View, key string, operator Op, operand interface{}, match_all bool) QueryContextReturn {
	log4go.Fine("Query context: %s, %v, %v, %v", key, operator, operand, match_all)
	for i := range qe {
		r := qe[i](v, key, operator, operand, match_all)
		if r != Unknown {
			return r
		}
	}
	log4go.Fine("Unknown context: %s", key)
	return Unknown
}
開發者ID:kiawin,項目名稱:lime,代碼行數:11,代碼來源:events.go

示例4: Yield

func (je *JoinEngine) Yield(s *protocol.Series) (bool, error) {
	log4go.Fine("JoinEngine.Yield(): %s", s)
	idx := je.tableIdx[s.GetName()]
	state := &je.tablesState[idx]
	// If the state for this table didn't contain a point already,
	// increment the number of tables ready to emit a point by
	// incrementing `pts`
	if state.lastPoint == nil {
		je.pts++
	}
	state.lastPoint = s.Points[len(s.Points)-1]
	// update the fields for this table. the fields shouldn't change
	// after the first point, so we only need to set them once
	if state.lastFields == nil {
		for _, f := range s.Fields {
			state.lastFields = append(state.lastFields, s.GetName()+"."+f)
		}
	}

	log4go.Fine("JoinEngine: pts = %d", je.pts)
	// if the number of tables ready to emit a point isn't equal to the
	// total number of tables being joined, then return
	if je.pts != len(je.tablesState) {
		return true, nil
	}

	// we arbitrarily use the timestamp of the first table's point as
	// the timestamp of the resulting point. may be we should use the
	// smalles (or largest) timestamp.
	ts := je.tablesState[0].lastPoint.Timestamp
	newSeries := &protocol.Series{
		Name:   &je.name,
		Fields: je.fields(),
		Points: []*protocol.Point{
			{
				Timestamp: ts,
				Values:    je.values(),
			},
		},
	}

	// filter the point. the user may have a where clause with the join,
	// e.g. `select * from join(foo1, foo2) where foo1.val > 10`. we
	// can't evaluate the where clause until after join happens
	filteredSeries, err := Filter(je.query, newSeries)
	if err != nil {
		return false, err
	}

	if len(filteredSeries.Points) > 0 {
		return je.next.Yield(newSeries)
	}
	return true, nil
}
開發者ID:ericcapricorn,項目名稱:influxdb,代碼行數:54,代碼來源:join_engine.go

示例5: ReturnShard

func (self *ShardDatastore) ReturnShard(id uint32) {
	self.shardsLock.Lock()
	defer self.shardsLock.Unlock()
	log.Fine("Returning shard. id = %d", id)
	self.shardRefCounts[id] -= 1
	if self.shardRefCounts[id] != 0 {
		return
	}

	log.Fine("Checking if shard should be deleted. id = %d", id)
	if _, ok := self.shardsToDelete[id]; ok {
		self.deleteShard(id)
		return
	}

	log.Fine("Checking if shard should be closed. id = %d", id)
	if self.shardsToClose[id] {
		self.closeShard(id)
	}
}
開發者ID:carriercomm,項目名稱:facette,代碼行數:20,代碼來源:shard_datastore.go

示例6: Cache

func (p *Pattern) Cache(data string, pos int) (pat *Pattern, ret MatchObject) {
	if p.cachedData == data {
		if p.cachedMatch == nil {
			return nil, nil
		}
		if p.cachedMatch[0] >= pos && p.cachedPat.cachedMatch != nil {
			p.hits++
			return p.cachedPat, p.cachedMatch
		}
	} else {
		p.cachedPatterns = nil
	}
	if p.cachedPatterns == nil {
		p.cachedPatterns = make([]*Pattern, len(p.Patterns))
		for i := range p.cachedPatterns {
			p.cachedPatterns[i] = &p.Patterns[i]
		}
	}
	p.misses++

	if p.Match.re != nil {
		pat, ret = p, p.Match.Find(data, pos)
	} else if p.Begin.re != nil {
		pat, ret = p, p.Begin.Find(data, pos)
	} else if p.Include != "" {
		if z := p.Include[0]; z == '#' {
			key := p.Include[1:]
			if p2, ok := p.owner.Repository[key]; ok {
				pat, ret = p2.Cache(data, pos)
			} else {
				log4go.Fine("Not found in repository: %s", p.Include)
			}
		} else if z == '$' {
			// TODO(q): Implement tmLanguage $ include directives
			log4go.Warn("Unhandled include directive: %s", p.Include)
		} else if l, err := Provider.GetLanguage(p.Include); err != nil {
			if !failed[p.Include] {
				log4go.Warn("Include directive %s failed: %s", p.Include, err)
			}
			failed[p.Include] = true
		} else {
			return l.RootPattern.Cache(data, pos)
		}
	} else {
		pat, ret = p.FirstMatch(data, pos)
	}
	p.cachedData = data
	p.cachedMatch = ret
	p.cachedPat = pat

	return
}
開發者ID:richardfontana,項目名稱:lime,代碼行數:52,代碼來源:language.go

示例7: Fields

func (td *TypeDef) Fields() (fields []content.Field, err error) {
	if td.ct.Name.Relative != "" {
		return td.ct.Fields, nil
	}

	var (
		mu               = td.index.(*ConcreteTableIndex).metadataUtil
		startRow, endRow = td.ListRange(td.index.Index(), id_TypeDef, id_Field, func(i interface{}) uint32 { return i.(*TypeDefRow).FieldList.Index() })
		idx              = ConcreteTableIndex{mu, startRow, id_Field}
	)
	cn := stripProto(td.Name().Absolute)
	for i := startRow; i < endRow; i++ {
		idx.index = i
		if rawfield, err := idx.Data(); err != nil {
			return nil, err
		} else {
			var (
				field = rawfield.(*FieldRow)
				f     content.Field
				dec   *SignatureDecoder
				sig   FieldSig
			)
			f.Name.Relative = string(field.Name)
			f.Name.Absolute = fmt.Sprintf("net://field/%s;%d", cn, i-startRow)
			if dec, err = NewSignatureDecoder(field.Signature); err != nil {
				return nil, err
			} else if err = dec.Decode(&sig); err != nil {
				return nil, err
			} else {
				f.Type = td.initContentType(td.index, &sig.Type)
			}
			if field.Flags&FieldAttributes_Static != 0 {
				f.Flags |= content.FLAG_STATIC
			}
			if field.Flags&FieldAttributes_Public != 0 {
				f.Flags |= content.FLAG_ACC_PUBLIC
			} else if field.Flags&FieldAttributes_Private != 0 {
				f.Flags |= content.FLAG_ACC_PRIVATE
			} else if field.Flags&FieldAttributes_Family != 0 {
				f.Flags |= content.FLAG_ACC_PROTECTED
			}
			if err := check(&f, f.Name); err != nil {
				log4go.Fine("Skipping field: %s, %+v, %+v", err, f, field)
				continue
			}
			fields = append(fields, f)
		}
	}
	return fields, nil
}
開發者ID:jerchung,項目名稱:completion,代碼行數:50,代碼來源:typedef.go

示例8: RunApplicationCommand

func (ch *commandHandler) RunApplicationCommand(name string, args Args) error {
	p := Prof.Enter("ac")
	defer p.Exit()
	if ch.log {
		log4go.Info("Running application command: %s %v", name, args)
	} else {
		log4go.Fine("Running application command: %s %v", name, args)
	}
	if c := ch.ApplicationCommands[name]; c != nil {
		if err := c.Run(args); err != nil && ch.verbose {
			log4go.Debug("Command execution failed: %s", err)
		}
	}
	return nil
}
開發者ID:richardfontana,項目名稱:lime,代碼行數:15,代碼來源:commandhandler.go

示例9: DeleteShard

func (self *ShardDatastore) DeleteShard(shardId uint32) {
	self.shardsLock.Lock()
	defer self.shardsLock.Unlock()
	// If someone has a reference to the shard we can't delete it
	// now. We have to wait until it's returned and delete
	// it. ReturnShard will take care of that as soon as the reference
	// count becomes 0.
	if refc := self.shardRefCounts[shardId]; refc > 0 {
		log.Fine("Cannot delete shard: shardId = %d, shardRefCounts[shardId] = %d", shardId, refc)
		self.shardsToDelete[shardId] = struct{}{}
		return
	}

	// otherwise, close the shard and delete it now
	self.deleteShard(shardId)
}
開發者ID:carriercomm,項目名稱:facette,代碼行數:16,代碼來源:shard_datastore.go

示例10: EndEdit

func (v *View) EndEdit(edit *Edit) {
	if edit.invalid {
		log4go.Fine("This edit has already been invalidated: %v, %v", edit, v.editstack)
		return
	}
	i := len(v.editstack) - 1
	for i := len(v.editstack) - 1; i >= 0; i-- {
		if v.editstack[i] == edit {
			break
		}
	}
	if i == -1 {
		log4go.Error("This edit isn't even in the stack... where did it come from? %v, %v", edit, v.editstack)
		return
	}

	var selmod bool

	if l := len(v.editstack) - 1; i != l {
		log4go.Error("This edit wasn't last in the stack... %d !=  %d: %v, %v", i, l, edit, v.editstack)
	}
	for j := len(v.editstack) - 1; j >= i; j-- {
		ce := v.editstack[j]
		ce.invalid = true
		is := reflect.DeepEqual(*v.Sel(), ce.savedSel)
		ib := v.buffer.ChangeCount() == ce.savedCount
		eq := (is && ib && ce.composite.Len() == 0)
		if !eq && is {
			selmod = true
		}
		if v.scratch || ce.bypassUndo || eq {
			continue
		}
		if i == 0 || j != i {
			// Presume someone forgot to add it in the j != i case
			v.undoStack.Add(edit)
		} else {
			// This edit belongs to another edit
			v.editstack[i-1].composite.Add(ce)
		}
	}
	v.editstack = v.editstack[:i]
	if selmod {
		OnSelectionModified.Call(v)
	}
}
開發者ID:nicecai,項目名稱:lime,代碼行數:46,代碼來源:view.go

示例11: SaveAs

// Saves the file to the specified filename
func (v *View) SaveAs(name string) (err error) {
	log4go.Fine("SaveAs(%s)", name)
	v.Settings().Set("lime.saving", true)
	defer v.Settings().Erase("lime.saving")
	var atomic bool
	OnPreSave.Call(v)
	if atomic, _ = v.Settings().Get("atomic_save", true).(bool); v.buffer.FileName() == "" || !atomic {
		if err := v.nonAtomicSave(name); err != nil {
			return err
		}
	} else {
		n, err := ioutil.TempDir(path.Dir(v.buffer.FileName()), "lime")
		if err != nil {
			return err
		}
		tmpf := path.Join(n, "tmp")
		if err := v.nonAtomicSave(tmpf); err != nil {
			return err
		}
		if err := os.Rename(tmpf, name); err != nil {
			// When we wan't to save as a file in another directory
			// we can't go with os.Rename so we need to force
			// not atomic saving sometimes as 4th test in TestSaveAsOpenFile
			if err := v.nonAtomicSave(name); err != nil {
				return err
			}
		}
		if err := os.RemoveAll(n); err != nil {
			return err
		}
	}

	ed := GetEditor()
	if v.buffer.FileName() != name {
		v.Buffer().SetFileName(name)
		// TODO(.): There could be multiple watchers tied to a single filename...
		ed.UnWatch(v.buffer.FileName())
		ed.Watch(NewWatchedUserFile(v))
	}

	v.buffer.Settings().Set("lime.last_save_change_count", v.buffer.ChangeCount())
	OnPostSave.Call(v)
	return nil
}
開發者ID:BinaryPaean,項目名稱:lime,代碼行數:45,代碼來源:view.go

示例12: CheckForUpdatedConfigs

func CheckForUpdatedConfigs(auto_update string, config_url string, api_key string, output_dir string, agent_bin string, out chan<- *AgentConfigType, defaults Consts) {
	for {
		config_data := ParseJsonFromHttp(config_url, api_key)
		out <- &config_data

		if auto_update == "true" && config_data.Version != defaults.Current_build {
			l4g.Debug("Upgrading agent version-%s\n", config_data.Version)
			hdata := config_data.Sha256
			if runtime.GOARCH == "amd64" {
				hdata = config_data.Sha256_amd64
			}
			Upgrade_version(config_data.Version, hdata, output_dir, agent_bin, defaults)
			l4g.Debug("Failed upgrading!\n")
		} else {
			l4g.Fine("Don't need to upgrade versions\n")
		}
		time.Sleep(10 * time.Second)
	}

}
開發者ID:pombredanne,項目名稱:ranger-1,代碼行數:20,代碼來源:config.go

示例13: StoreParsedURL

func (ds *CassandraDatastore) StoreParsedURL(u *URL, fr *FetchResults) {
	if !u.IsAbs() {
		log4go.Warn("Link should not have made it to StoreParsedURL: %v", u)
		return
	}
	dom, subdom, err := u.TLDPlusOneAndSubdomain()
	if err != nil {
		log4go.Debug("StoreParsedURL not storing %v: %v", fr.URL, err)
		return
	}

	if Config.AddNewDomains {
		ds.addDomainIfNew(dom)
	}
	log4go.Fine("Inserting parsed URL: %v", u)
	err = ds.db.Query(`INSERT INTO links (dom, subdom, path, proto, time)
						VALUES (?, ?, ?, ?, ?)`,
		dom, subdom, u.RequestURI(), u.Scheme, NotYetCrawled).Exec()
	if err != nil {
		log4go.Error("failed inserting parsed url (%v) to cassandra, %v", u, err)
	}
}
開發者ID:pombredanne,項目名稱:walker-2,代碼行數:22,代碼來源:datastore.go

示例14: onEvent

func (c *ViewEventGlue) onEvent(v *backend.View) {
	l := py.NewLock()
	defer l.Unlock()
	if pv, err := toPython(v); err != nil {
		log4go.Error(err)
	} else {
		defer pv.Decref()
		log4go.Fine("onEvent: %v, %v, %v", c, c.inner, pv)
		// interrupt := true
		// defer func() { interrupt = false }()
		// go func() {
		// 	<-time.After(time.Second * 5)
		// 	if interrupt {
		// 		py.SetInterrupt()
		// 	}
		// }()

		if ret, err := c.inner.Base().CallFunctionObjArgs(pv); err != nil {
			log4go.Error(err)
		} else if ret != nil {
			ret.Decref()
		}
	}
}
開發者ID:networkpku,項目名稱:lime,代碼行數:24,代碼來源:events_manual.go

示例15: start

// start blocks until the fetcher has completed by being told to quit.
func (f *fetcher) start() {
	log4go.Debug("Starting new fetcher")
	for {
		if f.host != "" {
			//TODO: ensure that this unclaim will happen... probably want the
			//logic below in a function where the Unclaim is deferred
			log4go.Info("Finished crawling %v, unclaiming", f.host)
			f.fm.Datastore.UnclaimHost(f.host)
		}

		select {
		case <-f.quit:
			f.done <- struct{}{}
			return
		default:
		}

		f.host = f.fm.Datastore.ClaimNewHost()
		if f.host == "" {
			time.Sleep(time.Second)
			continue
		}

		if f.checkForBlacklisting(f.host) {
			continue
		}

		f.fetchRobots(f.host)
		f.crawldelay = time.Duration(Config.DefaultCrawlDelay) * time.Second
		if f.robots != nil && int(f.robots.CrawlDelay) > Config.DefaultCrawlDelay {
			f.crawldelay = f.robots.CrawlDelay
		}
		log4go.Info("Crawling host: %v with crawl delay %v", f.host, f.crawldelay)

		for link := range f.fm.Datastore.LinksForHost(f.host) {
			//TODO: check <-f.quit and clean up appropriately

			fr := &FetchResults{URL: link}

			if f.robots != nil && !f.robots.Test(link.String()) {
				log4go.Debug("Not fetching due to robots rules: %v", link)
				fr.ExcludedByRobots = true
				f.fm.Datastore.StoreURLFetchResults(fr)
				continue
			}

			time.Sleep(f.crawldelay)

			fr.FetchTime = time.Now()
			fr.Response, fr.RedirectedFrom, fr.FetchError = f.fetch(link)
			if fr.FetchError != nil {
				log4go.Debug("Error fetching %v: %v", link, fr.FetchError)
				f.fm.Datastore.StoreURLFetchResults(fr)
				continue
			}
			log4go.Debug("Fetched %v -- %v", link, fr.Response.Status)

			ctype, ctypeOk := fr.Response.Header["Content-Type"]
			if ctypeOk && len(ctype) > 0 {
				media_type, _, err := mime.ParseMediaType(ctype[0])
				if err != nil {
					log4go.Error("Failed to parse mime header %q: %v", ctype[0], err)
				} else {
					fr.MimeType = media_type
				}
			}

			canSearch := isHTML(fr.Response)
			if canSearch {
				log4go.Debug("Reading and parsing as HTML (%v)", link)

				//TODO: ReadAll is inefficient. We should use a properly sized
				//		buffer here (determined by
				//		Config.MaxHTTPContentSizeBytes or possibly
				//		Content-Length of the response)
				var body []byte
				body, fr.FetchError = ioutil.ReadAll(fr.Response.Body)
				if fr.FetchError != nil {
					log4go.Debug("Error reading body of %v: %v", link, fr.FetchError)
					f.fm.Datastore.StoreURLFetchResults(fr)
					continue
				}
				fr.Response.Body = ioutil.NopCloser(bytes.NewReader(body))

				outlinks, err := getLinks(body)
				if err != nil {
					log4go.Debug("error parsing HTML for page %v: %v", link, err)
				} else {
					for _, outlink := range outlinks {
						outlink.MakeAbsolute(link)
						log4go.Fine("Parsed link: %v", outlink)
						if shouldStore(outlink) {
							f.fm.Datastore.StoreParsedURL(outlink, fr)
						}
					}
				}
			}

			// handle any doc that we searched or that is in our AcceptFormats
//.........這裏部分代碼省略.........
開發者ID:pombredanne,項目名稱:walker-2,代碼行數:101,代碼來源:fetcher.go


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