3 Commits

Author SHA1 Message Date
7b6634a7bb Update Go module version to 1.24.0 and simplify dependencies in go.mod and go.sum 2025-10-26 18:32:17 +00:00
485bd3f70b Update log level specifications to include trailing spaces for better formatting 2025-10-21 21:38:02 +01:00
9b90315f37 Delete outdated benchmark reports and results.
Removed old benchmark reports and detailed logs from the repository to clean up unnecessary files. These reports appear to be auto-generated and no longer relevant for ongoing development.
2025-09-15 05:00:19 +01:00
3 changed files with 17 additions and 45 deletions

13
go.mod
View File

@@ -1,14 +1,5 @@
module lol.mleku.dev
go 1.25.0
go 1.24.0
require (
github.com/davecgh/go-spew v1.1.1
github.com/fatih/color v1.18.0
)
require (
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
golang.org/x/sys v0.35.0 // indirect
)
require github.com/davecgh/go-spew v1.1.1

9
go.sum
View File

@@ -1,11 +1,2 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=

40
log.go
View File

@@ -13,7 +13,6 @@ import (
"time"
"github.com/davecgh/go-spew/spew"
"github.com/fatih/color"
)
const (
@@ -88,13 +87,13 @@ var (
// LevelSpecs specifies the id, string name and color-printing function
LevelSpecs = []LevelSpec{
{Off, "", NoSprint},
{Fatal, "FTL", color.New(color.BgRed, color.FgHiWhite).Sprint},
{Error, "ERR", color.New(color.FgHiRed).Sprint},
{Warn, "WRN", color.New(color.FgHiYellow).Sprint},
{Info, "INF", color.New(color.FgHiGreen).Sprint},
{Debug, "DBG", color.New(color.FgHiBlue).Sprint},
{Trace, "TRC", color.New(color.FgHiMagenta).Sprint},
{Off, " ", NoSprint},
{Fatal, "☠️ ", fmt.Sprint},
{Error, "🚨 ", fmt.Sprint},
{Warn, "⚠️ ", fmt.Sprint},
{Info, " ", fmt.Sprint},
{Debug, "🔎 ", fmt.Sprint},
{Trace, "👻 ", fmt.Sprint},
}
)
@@ -185,7 +184,7 @@ func JoinStrings(a ...any) (s string) {
return
}
var msgCol = color.New(color.FgBlue).Sprint
var msgCol = fmt.Sprint
// GetPrinter returns a full logger that writes to the provided io.Writer.
func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
@@ -196,7 +195,7 @@ func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
}
_, _ = fmt.Fprintf(
writer,
"%s%s %s %s\n",
"%s%s%s %s\n",
msgCol(TimeStamper()),
LevelSpecs[l].Colorizer(LevelSpecs[l].Name),
JoinStrings(a...),
@@ -209,7 +208,7 @@ func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
}
_, _ = fmt.Fprintf(
writer,
"%s%s %s %s\n",
"%s%s%s %s\n",
msgCol(TimeStamper()),
LevelSpecs[l].Colorizer(LevelSpecs[l].Name),
fmt.Sprintf(format, a...),
@@ -222,7 +221,7 @@ func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
}
_, _ = fmt.Fprintf(
writer,
"%s%s %s %s\n",
"%s%s%s %s\n",
msgCol(TimeStamper()),
LevelSpecs[l].Colorizer(LevelSpecs[l].Name),
spew.Sdump(a...),
@@ -235,7 +234,7 @@ func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
}
_, _ = fmt.Fprintf(
writer,
"%s%s %s %s\n",
"%s%s%s %s\n",
msgCol(TimeStamper()),
LevelSpecs[l].Colorizer(LevelSpecs[l].Name),
closure(),
@@ -249,7 +248,7 @@ func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
if e != nil {
_, _ = fmt.Fprintf(
writer,
"%s%s %s %s\n",
"%s%s%s %s\n",
msgCol(TimeStamper()),
LevelSpecs[l].Colorizer(LevelSpecs[l].Name),
e.Error(),
@@ -263,7 +262,7 @@ func GetPrinter(l int32, writer io.Writer, skip int) LevelPrinter {
if Level.Load() >= l {
_, _ = fmt.Fprintf(
writer,
"%s%s %s %s\n",
"%s%s%s %s\n",
msgCol(TimeStamper()),
LevelSpecs[l].Colorizer(LevelSpecs[l].Name),
fmt.Sprintf(format, a...),
@@ -325,16 +324,7 @@ func New(writer io.Writer, skip int) (l *Log, c *Check, errorf *Errorf) {
// TimeStamper generates the timestamp for logs.
func TimeStamper() (s string) {
ts := time.Now().Format("150405.000000")
ds := time.Now().Format("2006-01-02")
s += color.New(color.FgBlue).Sprint(ds[0:4])
s += color.New(color.FgHiBlue).Sprint(ds[5:7])
s += color.New(color.FgBlue).Sprint(ds[8:])
s += color.New(color.FgHiBlue).Sprint(ts[0:2])
s += color.New(color.FgBlue).Sprint(ts[2:4])
s += color.New(color.FgHiBlue).Sprint(ts[4:6])
s += color.New(color.FgBlue).Sprint(ts[7:])
s += " "
s = fmt.Sprint(time.Now().UnixMicro())
return
}