本文整理汇总了Golang中code/google/com/p/log4go.Logf函数的典型用法代码示例。如果您正苦于以下问题:Golang Logf函数的具体用法?Golang Logf怎么用?Golang Logf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Logf函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: RunTextCommand
func (ch *commandHandler) RunTextCommand(view *View, name string, args Args) error {
lvl := log4go.FINE
p := Prof.Enter("tc")
defer p.Exit()
t := time.Now()
if ch.log {
lvl = log4go.DEBUG
}
log4go.Logf(lvl, "Running text command: %s %v", name, args)
if c, ok := ch.TextCommands[name].(TextCommand); c != nil && ok {
if err := ch.init(c, args); err != nil && ch.verbose {
log4go.Debug("Command initialization failed: %s", err)
return err
} else if err := view.runCommand(c, name); err != nil {
log4go.Logf(lvl, "Command execution failed: %s", err)
return err
}
} else if w := view.Window(); w != nil {
if c, ok := ch.WindowCommands[name].(WindowCommand); c != nil && ok {
if err := w.runCommand(c, name); err != nil {
log4go.Logf(lvl, "Command execution failed: %s", err)
return err
}
}
}
log4go.Logf(lvl, "Ran text command: %s %s", name, time.Since(t))
return nil
}
开发者ID:ryancmorris1,项目名称:lime,代码行数:28,代码来源:commandhandler.go
示例2: 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
示例3: RunWindowCommand
func (ch *commandHandler) RunWindowCommand(wnd *Window, name string, args Args) error {
lvl := log4go.FINE
p := Prof.Enter("wc")
defer p.Exit()
if ch.log {
lvl = log4go.DEBUG
}
log4go.Logf(lvl, "Running window command: %s %v", name, args)
t := time.Now()
if c := ch.WindowCommands[name]; c != nil {
if err := wnd.runCommand(c, name, args); err != nil {
log4go.Logf(lvl+1, "Command execution failed: %s", err)
} else {
log4go.Logf(lvl, "Ran Window command: %s %s", name, time.Since(t))
}
} else {
log4go.Logf(lvl, "No such window command: %s", name)
}
return nil
}
开发者ID:richardfontana,项目名称:lime,代码行数:20,代码来源:commandhandler.go
注:本文中的code/google/com/p/log4go.Logf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论