Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report a panic crash #17

Closed
chengang666 opened this issue Jan 26, 2019 · 1 comment
Closed

report a panic crash #17

chengang666 opened this issue Jan 26, 2019 · 1 comment

Comments

@chengang666
Copy link

goroutine 17 [running]:
bytes.(*Buffer).WriteString(0xc0000fe310, 0x0, 0x7, 0x3, 0x3, 0x0)
C:/Go/src/bytes/buffer.go:188 +0xc7
github.com/jeanphorn/log4go.FormatLogRecord(0x731e02, 0x19, 0xc000050410, 0x1, 0x1)
C:/Users/Administrator/go/src/github.com/jeanphorn/log4go/pattlog.go:94 +0x44e
github.com/jeanphorn/log4go.(*ConsoleLogWriter).run(0xc000104220, 0x77c140, 0xc00000c018)
C:/Users/Administrator/go/src/github.com/jeanphorn/log4go/termlog.go:34 +0x70
created by github.com/jeanphorn/log4go.NewConsoleLogWriter
C:/Users/Administrator/go/src/github.com/jeanphorn/log4go/termlog.go:26 +0xba

I fixed this bug:

//please patch this file : pattlog.go
func FormatLogRecord(format string, rec *LogRecord) string {
//--------------------------------
//fix crash
defer func() {
if e := recover(); e != nil {
fmt.Printf("Panicing %s\n", e)
}
}()
//--------------------------------
....

@jeanphorn
Copy link
Owner

add recover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants