本文整理汇总了Golang中code/google/com/p/log4go.Exit函数的典型用法代码示例。如果您正苦于以下问题:Golang Exit函数的具体用法?Golang Exit怎么用?Golang Exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Exit函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
flag.Parse()
log4go.AddFilter("file", log4go.FINEST, log4go.NewFileLogWriter("debug.log", *rotateLog))
defer func() {
py.NewLock()
py.Finalize()
}()
if err := termbox.Init(); err != nil {
log4go.Exit(err)
}
defer func() {
termbox.Close()
log4go.Debug(util.Prof)
if err := recover(); err != nil {
log4go.Crash(err)
}
}()
var t tbfe
t.dorender = make(chan bool, render_chan_len)
t.layout = make(map[*backend.View]layout)
t.loop()
}
示例2: randNodeId
func randNodeId() []byte {
b := make([]byte, 20)
if _, err := rand.Read(b); err != nil {
l4g.Exit("nodeId rand:", err)
}
return b
}
示例3: main
func main() {
if err := termbox.Init(); err != nil {
log4go.Exit(err)
}
var t tbfe
t.visibleregion = make(map[*backend.View]primitives.Region)
t.loop()
}
示例4: main
func main() {
bin.IncludeHelp()
err := bin.Run()
// TODO: HACK! See https://code.google.com/p/log4go/issues/detail?id=8
// Give log4go a chance to catch up and print all its messages
time.Sleep(time.Second)
if err != nil {
log4go.Exit(err)
}
}
示例5: main
func main() {
log4go.AddFilter("file", log4go.FINEST, log4go.NewFileLogWriter("debug.log", true))
defer func() {
py.NewLock()
py.Finalize()
}()
if err := termbox.Init(); err != nil {
log4go.Exit(err)
}
var t tbfe
t.dorender = make(chan bool, render_chan_len)
t.layout = make(map[*backend.View]layout)
go t.renderthread()
t.loop()
}
示例6: loop
func (t *tbfe) loop() {
qml.Init(nil)
engine := qml.NewEngine()
engine.Context().SetVar("lines", t)
engine.Context().SetVar("frontend", t)
engine.Context().SetVar("editor", backend.GetEditor())
backend.OnNew.Add(func(v *backend.View) {
fv := &frontendView{bv: v}
v.Buffer().AddCallback(fv.bufferChanged)
v.Settings().AddOnChange("blah", func(name string) {
if name == "lime.syntax.updated" {
// force redraw, as the syntax regions might have changed...
for i := range fv.FormattedLine {
fv.formatLine(i)
}
}
})
t.views[v] = fv
t.Len = len(t.views)
qml.Changed(t, &t.Len)
})
ed := backend.GetEditor()
ed.SetFrontend(t)
ed.LogInput(false)
ed.LogCommands(false)
c := ed.Console()
t.Console = &frontendView{bv: c}
c.Buffer().AddCallback(t.Console.bufferChanged)
if sc, err := textmate.LoadTheme("../../3rdparty/bundles/TextMate-Themes/GlitterBomb.tmTheme"); err != nil {
log4go.Error(err)
} else {
scheme = sc
}
defer func() {
fmt.Println(util.Prof)
}()
w := ed.NewWindow()
v := w.OpenFile("main.go", 0)
v.Settings().Set("trace", true)
v.Settings().Set("syntax", "../../3rdparty/bundles/go.tmbundle/Syntaxes/Go.tmLanguage")
c.Buffer().AddCallback(t.scroll)
sel := v.Sel()
sel.Clear()
sel.Add(Region{0, 0})
{
w, h := 800, 600
t.lock.Lock()
t.layout[v] = layout{0, 0, w, h - console_height - 1, Region{}, 0}
t.layout[c] = layout{0, h - console_height + 1, w, console_height - 5, Region{}, 0}
t.lock.Unlock()
t.Show(v, Region{1, 1})
}
t.Show(v, Region{100, 100})
t.Show(v, Region{1, 1})
// t.Len, _ = v.Buffer().RowCol(v.Buffer().Size())
ed.Init()
sublime.Init()
component, err := engine.LoadFile("main.qml")
if err != nil {
log4go.Exit(err)
}
window := component.CreateWindow(nil)
window.Show()
log4go.Debug("Done")
window.Wait()
}
示例7: loop
func (t *tbfe) loop() {
qml.Init(nil)
engine := qml.NewEngine()
engine.Context().SetVar("lines", t)
engine.Context().SetVar("frontend", t)
engine.Context().SetVar("editor", backend.GetEditor())
backend.OnNew.Add(func(v *backend.View) {
fv := &frontendView{bv: v}
v.Buffer().AddCallback(fv.bufferChanged)
v.Settings().AddOnChange("blah", func(name string) {
if name == "lime.syntax.updated" {
// force redraw, as the syntax regions might have changed...
for i := range fv.FormattedLine {
fv.formatLine(i)
}
}
})
fv.Title.Text = v.Buffer().FileName()
if len(fv.Title.Text) == 0 {
fv.Title.Text = "untitled"
}
w2 := t.windows[v.Window()]
w2.views = append(w2.views, fv)
w2.Len = len(w2.views)
t.qmlChanged(w2, &w2.Len)
})
backend.OnLoad.Add(func(v *backend.View) {
w2 := t.windows[v.Window()]
i := 0
for i, _ = range w2.views {
if w2.views[i].bv == v {
break
}
}
v2 := w2.views[i]
v2.Title.Text = v.Buffer().FileName()
t.qmlChanged(v2, &v2.Title)
})
ed := backend.GetEditor()
ed.SetFrontend(t)
ed.LogInput(false)
ed.LogCommands(false)
c := ed.Console()
t.Console = &frontendView{bv: c}
c.Buffer().AddCallback(t.Console.bufferChanged)
c.Buffer().AddCallback(t.scroll)
component, err := engine.LoadFile("main.qml")
if err != nil {
log4go.Exit(err)
}
wg := sync.WaitGroup{}
backend.OnNewWindow.Add(func(w *backend.Window) {
wg.Add(1)
fw := &frontendWindow{bw: w, window: component.CreateWindow(nil)}
t.windows[w] = fw
fw.window.Show()
fw.window.Set("myWindow", fw)
go func() {
fw.window.Wait()
wg.Done()
}()
})
// TODO: should be done backend side
if sc, err := textmate.LoadTheme("../../3rdparty/bundles/TextMate-Themes/GlitterBomb.tmTheme"); err != nil {
log4go.Error(err)
} else {
scheme = sc
}
defer func() {
fmt.Println(util.Prof)
}()
w := ed.NewWindow()
v := w.OpenFile("main.go", 0)
// TODO: should be done backend side
v.Settings().Set("syntax", "../../3rdparty/bundles/go.tmbundle/Syntaxes/Go.tmLanguage")
v = w.OpenFile("../../backend/editor.go", 0)
// TODO: should be done backend side
v.Settings().Set("syntax", "../../3rdparty/bundles/go.tmbundle/Syntaxes/Go.tmLanguage")
ed.Init()
sublime.Init()
wg.Wait()
}
示例8: loop
func (t *tbfe) loop() {
qml.Init(nil)
engine := qml.NewEngine()
engine.Context().SetVar("lines", t)
engine.Context().SetVar("frontend", t)
engine.Context().SetVar("editor", backend.GetEditor())
backend.OnNew.Add(func(v *backend.View) {
v.Settings().AddOnChange("lime.frontend.html.render", func(name string) { t.dirty = true })
})
backend.OnModified.Add(func(v *backend.View) {
t.dirty = true
})
backend.OnSelectionModified.Add(func(v *backend.View) {
t.dirty = true
})
ed := backend.GetEditor()
ed.SetFrontend(t)
ed.LogInput(false)
ed.LogCommands(false)
c := ed.Console()
if sc, err := textmate.LoadTheme("../../3rdparty/bundles/TextMate-Themes/GlitterBomb.tmTheme"); err != nil {
log4go.Error(err)
} else {
scheme = sc
}
defer func() {
fmt.Println(util.Prof)
}()
w := ed.NewWindow()
v := w.OpenFile("main.go", 0)
v.Settings().Set("trace", true)
v.Settings().Set("syntax", "../../3rdparty/bundles/go.tmbundle/Syntaxes/Go.tmLanguage")
c.Buffer().AddCallback(t.scroll)
sel := v.Sel()
sel.Clear()
sel.Add(Region{0, 0})
{
w, h := 800, 600
t.lock.Lock()
t.layout[v] = layout{0, 0, w, h - console_height - 1, Region{}, 0}
t.layout[c] = layout{0, h - console_height + 1, w, console_height - 5, Region{}, 0}
t.lock.Unlock()
t.Show(v, Region{1, 1})
}
t.Show(v, Region{100, 100})
t.Show(v, Region{1, 1})
t.Len, _ = v.Buffer().RowCol(v.Buffer().Size())
ed.Init()
sublime.Init()
component, err := engine.LoadFile("main.qml")
if err != nil {
log4go.Exit(err)
}
window := component.CreateWindow(nil)
window.Show()
qml.Changed(t, &t.Len)
log4go.Debug("Done")
window.Wait()
}