本文整理汇总了Golang中code/google/com/p/log4go.Finest函数的典型用法代码示例。如果您正苦于以下问题:Golang Finest函数的具体用法?Golang Finest怎么用?Golang Finest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Finest函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Reload
func (o *WatchedUserFile) Reload() {
log4go.Finest("\"%v\".Reload()", o)
view := o.view
filename := o.Name()
if saving, ok := view.Settings().Get("lime.saving", false).(bool); ok && saving {
// This reload was triggered by ourselves saving to this file, so don't reload it
return
}
if !GetEditor().Frontend().OkCancelDialog("File was changed by another program, reload?", "reload") {
return
}
if d, err := ioutil.ReadFile(filename); err != nil {
log4go.Error("Could not read file: %s\n. Error was: %v", filename, err)
} else {
edit := view.BeginEdit()
end := view.Buffer().Size()
view.Replace(edit, Region{0, end}, string(d))
view.EndEdit(edit)
}
}
开发者ID:BenedictEggers,项目名称:lime,代码行数:23,代码来源:watched.go
示例17: Call
// Trigger this ViewEvent by calling all the registered callbacks in order of registration.
func (ve *ViewEvent) Call(v *View) {
log4go.Finest("%s(%v)", evNames[ve], v.Id())
for _, ev := range *ve {
ev(v)
}
}
开发者ID:Unverified,项目名称:lime,代码行数:7,代码来源:events.go
示例18: UnWatch
func (e *Editor) UnWatch(name string) {
log4go.Finest("UnWatch(%s)", name)
delete(e.watchedFiles, name)
}
开发者ID:BenedictEggers,项目名称:lime,代码行数:4,代码来源:editor.go
示例19: Call
func (ve ViewEvent) Call(v *View) {
log4go.Finest("ViewEvent")
for i := range ve {
ve[i](v)
}
}
开发者ID:kiawin,项目名称:lime,代码行数:6,代码来源:events.go
示例20: Run
func (c *TextCommandGlue) Run(v *backend.View, e *backend.Edit) error {
l := py.NewLock()
defer l.Unlock()
p0 := util.Prof.Enter("tc.run")
defer p0.Exit()
var (
pyv, pye, pyargs, obj py.Object
err error
)
if pyv, err = toPython(v); err != nil {
return pyError(err)
}
defer pyv.Decref()
if pye, err = toPython(e); err != nil {
return pyError(err)
}
defer pye.Decref()
if pyargs, err = c.CreatePyArgs(c.args); err != nil {
return pyError(err)
}
defer pyargs.Decref()
init := util.Prof.Enter("tc.init")
if obj, err = c.inner.Base().CallFunctionObjArgs(pyv); err != nil {
return pyError(err)
}
defer obj.Decref()
init.Exit()
// interrupt := true
// defer func() { interrupt = false }()
// go func() {
// <-time.After(time.Second * 5)
// if interrupt {
// py.SetInterrupt()
// }
// }()
exec := util.Prof.Enter("tc.exec")
defer exec.Exit()
if obj.Base().HasAttrString("run_") {
// The plugin is probably trying to bypass the undostack...
old := v.IsScratch()
v.SetScratch(true)
log4go.Finest("Discarded: %s", e)
v.EndEdit(e)
v.SetScratch(old)
ret, err := obj.Base().CallMethodObjArgs("run_", pye, pyargs)
if ret != nil {
ret.Decref()
}
if err != nil {
return pyError(err)
}
return nil
}
ret, err := obj.Base().CallMethodObjArgs("run__", pye, pyargs)
if ret != nil {
ret.Decref()
}
if err != nil {
return pyError(err)
}
return nil
}
开发者ID:nadavvin,项目名称:lime,代码行数:66,代码来源:commands_manual.go
注:本文中的code/google/com/p/log4go.Finest函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论