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


Golang log4go.Finest函數代碼示例

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


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

示例1: denyPrivilegesHandler

// This is a URL handler that handles updating permissions for a user on an object
func denyPrivilegesHandler(w http.ResponseWriter, r *http.Request) {

	log.Finest("Inside deny privileges.")

	c, service, object, body, err := getRequestData(w, r, true)
	if err != nil {
		// Already responded in getBody call
		return
	}

	for _, val := range body {

		_, key, user, privileges := getItemData(w, val, true, true)
		if key == "" || user == "" {
			// Couldn't get proper data from body.  Already responded in getItemData call
			return
		}

		log.Finest("Denying privilege")

		_, err = ACL{}.Deny(c, service, object, key, user, privileges)

		if err != nil {
			log.Error("An error occurred denying privileges. Body: %s\n URL: %s\nMessage: %s",
				r.Body, r.URL.RequestURI(), err)
			http.Error(w, "An error occurred granting privileges", 500)
			return
		}
	}

	w.WriteHeader(204)
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:33,代碼來源:handlers.go

示例2: Register

func (ch *commandHandler) Register(name string, cmd interface{}) error {
	var r = false
	log4go.Finest("Want to register %s", name)
	if ac, ok := cmd.(ApplicationCommand); ok {
		if _, ok := ch.ApplicationCommands[name]; ok {
			return fmt.Errorf("%s is already a registered command", name)
		}
		r = true
		ch.ApplicationCommands[name] = ac
	}
	if wc, ok := cmd.(WindowCommand); ok {
		if _, ok := ch.WindowCommands[name]; ok {
			return fmt.Errorf("%s is already a registered command", name)
		}
		r = true
		ch.WindowCommands[name] = wc
	}
	if tc, ok := cmd.(TextCommand); ok {
		if _, ok := ch.TextCommands[name]; ok {
			return fmt.Errorf("%s is already a registered command", name)
		}
		r = true
		ch.TextCommands[name] = tc
	}
	if !r {
		return fmt.Errorf("Command wasn't registered in any list: %s", name)
	} else if ch.verbose {
		log4go.Finest("Successfully registered command %s", name)
	}
	return nil
}
開發者ID:ryancmorris1,項目名稱:lime,代碼行數:31,代碼來源:commandhandler.go

示例3: unWatch

func unWatch(name string) {
	if err := watcher.RemoveWatch(name); err != nil {
		log4go.Error("Couldn't unwatch file: %v", err)
	}
	log4go.Finest("UnWatch(%s)", name)
	delete(watchedPlugins, name)
}
開發者ID:Unverified,項目名稱:lime,代碼行數:7,代碼來源:sublime_manual.go

示例4: UnWatch

func (e *Editor) UnWatch(name string) {
	if err := e.watcher.RemoveWatch(name); err != nil {
		log4go.Error("Couldn't unwatch file: %v", err)
	}
	log4go.Finest("UnWatch(%s)", name)
	delete(e.watchedFiles, name)
}
開發者ID:jeppojeps,項目名稱:lime,代碼行數:7,代碼來源:editor.go

示例5: watch

func watch(plugin *backend.WatchedPackage) {
	log4go.Finest("Watch(%v)", plugin)
	if err := watcher.Watch(plugin.Name()); err != nil {
		log4go.Error("Could not watch plugin: %v", err)
	} else {
		watchedPlugins[plugin.Name()] = plugin
	}
}
開發者ID:Unverified,項目名稱:lime,代碼行數:8,代碼來源:sublime_manual.go

示例6: Watch

func (e *Editor) Watch(file Watched) {
	log4go.Finest("Watch(%v)", file)
	if err := e.watcher.Watch(file.Name()); err != nil {
		log4go.Error("Could not watch file: %v", err)
	} else {
		e.watchedFiles[file.Name()] = file
	}
}
開發者ID:jeppojeps,項目名稱:lime,代碼行數:8,代碼來源:editor.go

示例7: Set

// Sets the privileges to a whole new ACL
func (a ACL) Set(c *mgo.Collection, service string, object string, key string, user string, privileges map[string]interface{}) (*mgo.ChangeInfo, error) {
	selector := bson.M{"service": service, "object": object, "key": key, "user": user}
	update := copyMap(selector)
	update["privileges"] = privileges

	log.Finest("Setting Privilege: %s", update)
	return c.Upsert(selector, update)
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:9,代碼來源:models.go

示例8: inputthread

func (e *Editor) inputthread() {
	pc := 0
	var lastBindings KeyBindings
	doinput := func(kp KeyPress) {
		defer func() {
			if r := recover(); r != nil {
				log4go.Error("Panic in inputthread: %v\n%s", r, string(debug.Stack()))
				if pc > 0 {
					panic(r)
				}
				pc++
			}
		}()
		p := Prof.Enter("hi")
		defer p.Exit()

		lvl := log4go.FINE
		if e.loginput {
			lvl++
		}
		log4go.Logf(lvl, "Key: %v", kp)
		if lastBindings.keyOff == 0 {
			lastBindings = e.keyBindings
		}
	try_again:
		possible_actions := lastBindings.Filter(kp)
		lastBindings = possible_actions

		// TODO?
		var (
			wnd *Window
			v   *View
		)
		if wnd = e.ActiveWindow(); wnd != nil {
			v = wnd.ActiveView()
		}

		if action := possible_actions.Action(v); action != nil {
			p2 := Prof.Enter("hi.perform")
			e.RunCommand(action.Command, action.Args)
			p2.Exit()
		} else if possible_actions.keyOff > 1 {
			lastBindings = e.keyBindings
			goto try_again
		} else if kp.IsCharacter() {
			p2 := Prof.Enter("hi.character")
			log4go.Finest("kp: %v, pos: %v", kp, possible_actions)
			if err := e.CommandHandler().RunTextCommand(v, "insert", Args{"characters": string(rune(kp.Key))}); err != nil {
				log4go.Debug("Couldn't run textcommand: %s", err)
			}
			p2.Exit()
		}
	}
	for kp := range e.keyInput {
		doinput(kp)
	}
}
開發者ID:EDi-nabi,項目名稱:lime,代碼行數:57,代碼來源:editor.go

示例9: main

func main() {
	// Load the configuration (isn't this easy?)
	l4g.LoadConfiguration("example.xml")

	// And now we're ready!
	l4g.Finest("This will only go to those of you really cool UDP kids!  If you change enabled=true.")
	l4g.Debug("Oh no!  %d + %d = %d!", 2, 2, 2+2)
	l4g.Info("About that time, eh chaps?")
}
開發者ID:ChrisOHu,項目名稱:platform,代碼行數:9,代碼來源:XMLConfigurationExample.go

示例10: Revoke

// Revokes the privileges from the existing ACL
func (a ACL) Revoke(c *mgo.Collection, service string, object string, key string, user string, privileges []string) (*mgo.ChangeInfo, error) {
	selector := bson.M{"service": service, "object": object, "key": key, "user": user}
	toRevoke := map[string]interface{}{}
	for _, privilege := range privileges {
		toRevoke["privileges."+privilege] = ""
	}
	log.Finest("Revoking Privilege: %s, %s", selector, toRevoke)
	return c.Upsert(selector, bson.M{"$unset": toRevoke})
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:10,代碼來源:models.go

示例11: Has

// Retrieves the ACL from the collection using the object's key and the user, if the user is granted privileges
func (a ACL) Has(c *mgo.Collection, service string, object string, key string, user string, privileges []string) error {
	selector := bson.M{"service": service, "object": object, "key": key, "user": user}
	for _, privilege := range privileges {
		selector["privileges."+privilege] = "allow"
	}

	log.Finest("Checking user has privilege: %s", selector)
	result := ACL{}
	return c.Find(selector).One(&result)
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:11,代碼來源:models.go

示例12: Deny

// Denies the privileges from the existing ACL
func (a ACL) Deny(c *mgo.Collection, service string, object string, key string, user string, privileges []string) (*mgo.ChangeInfo, error) {
	selector := bson.M{"service": service, "object": object, "key": key, "user": user}
	update := copyMap(selector)

	for _, privilege := range privileges {
		update["privileges."+privilege] = "deny"
	}

	log.Finest("Denying Privilege: %s", update)
	return c.Upsert(selector, bson.M{"$set": update})
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:12,代碼來源:models.go

示例13: Match

// Retrieves a list of the keys for a service/object/user combo that the user has "allow" privileges for
func (a ACL) Match(c *mgo.Collection, service string, object string, user string, privileges []string) ([]string, error) {
	selector := bson.M{"service": service, "object": object, "user": user}
	for _, privilege := range privileges {
		selector["privileges."+privilege] = "allow"
	}

	log.Finest("Matching user privileges to keys: %s", selector)
	result := []string{}
	err := c.Find(selector).Distinct("key", &result)
	return result, err
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:12,代碼來源:models.go

示例14: getRequestData

// Gets common data from a request for certain request handlers
func getRequestData(w http.ResponseWriter, r *http.Request, processBody bool) (*mgo.Collection,
	string, string, []map[string]interface{}, error) {
	c := context.Get(r, "mongoColl").(*mgo.Collection)
	vars := mux.Vars(r)
	service := vars["service"]
	object := vars["object"]

	log.Finest("Request URL Info: service: %s object: %s", service, object)

	if processBody {
		body, err := getBody(w, r)
		return c, service, object, body, err
	} else {
		return c, service, object, nil, nil
	}
}
開發者ID:johnnadratowski,項目名稱:authorizer,代碼行數:17,代碼來源:handlers.go

示例15: renderthread

func (t *tbfe) renderthread() {
	pc := 0
	dorender := func() {
		defer func() {
			if r := recover(); r != nil {
				log4go.Error("Panic in renderthread: %v\n%s", r, string(debug.Stack()))
				if pc > 1 {
					panic(r)
				}
				pc++
			}
		}()
		termbox.Clear(defaultFg, defaultBg)
		w, h := termbox.Size()
		for y := 0; y < h; y++ {
			for x := 0; x < w; x++ {
				termbox.SetCell(x, y, ' ', defaultFg, defaultBg)
			}
		}
		t.lock.Lock()
		vs := make([]*backend.View, 0, len(t.layout))
		l := make([]layout, 0, len(t.layout))
		for k, v := range t.layout {
			vs = append(vs, k)
			l = append(l, v)
		}
		t.lock.Unlock()
		for i, v := range vs {
			t.renderView(v, l[i])
		}
		t.lock.Lock()
		runes := []rune(t.status_message)
		t.lock.Unlock()
		for i := 0; i < w && i < len(runes); i++ {
			termbox.SetCell(i, h-1, runes[i], defaultFg, defaultBg)
		}
		termbox.Flush()
	}
	for a := range t.dorender {
		_ = a
		log4go.Finest("Rendering")
		dorender()
	}
}
開發者ID:richardfontana,項目名稱:lime,代碼行數:44,代碼來源:main.go


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