removed go-errors

This commit is contained in:
2022-07-08 14:42:43 -04:00
parent cde6f47b0b
commit d3d9306aeb
3 changed files with 3 additions and 17 deletions

2
go.mod
View File

@@ -1,5 +1,3 @@
module article12apps.net/levellogger module article12apps.net/levellogger
go 1.18 go 1.18
require github.com/go-errors/errors v1.4.2

2
go.sum
View File

@@ -1,2 +0,0 @@
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=

View File

@@ -4,17 +4,9 @@ import (
"io" "io"
"log" "log"
//"runtime/debug" "runtime/debug"
"github.com/go-errors/errors"
) )
var traceable = errors.Errorf("Stack trace request")
func Crash() error {
return errors.New(traceable)
}
func NewLevelLogger(out io.Writer, level LogLevel) LevelLogger { func NewLevelLogger(out io.Writer, level LogLevel) LevelLogger {
var ll LevelLogger var ll LevelLogger
@@ -42,15 +34,13 @@ func (ll LevelLogger) Panicf(format string, v ...any) {
} }
func (ll LevelLogger) Trace(v ...any) { func (ll LevelLogger) Trace(v ...any) {
err := Crash()
ll.traceLog.Println(err.(*errors.Error).ErrorStack())
ll.traceLog.Println(v...) ll.traceLog.Println(v...)
ll.traceLog.Println(debug.Stack())
} }
func (ll LevelLogger) Tracef(format string, v ...any) { func (ll LevelLogger) Tracef(format string, v ...any) {
err := Crash()
ll.traceLog.Println(err.(*errors.Error).ErrorStack())
ll.traceLog.Printf(format, v...) ll.traceLog.Printf(format, v...)
ll.traceLog.Println(debug.Stack())
} }
func (ll LevelLogger) Debug(v ...any) { func (ll LevelLogger) Debug(v ...any) {