REPOSITORY / ScuroNeko/SNekLog
Compare commits
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19f8750d35
|
@@ -17,7 +17,7 @@ Russian version: [README_ru.md](README_ru.md)
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
go get git.scuroneko.dev/scuroneko/slog/v2
|
||||
go get git.scuroneko.dev/scuroneko/sneklog/v2
|
||||
```
|
||||
|
||||
## Quick start
|
||||
@@ -28,7 +28,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.scuroneko.dev/scuroneko/slog/v2"
|
||||
"git.scuroneko.dev/scuroneko/sneklog/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -147,7 +147,7 @@ An empty `old` value is ignored.
|
||||
|
||||
- Text writers use the nearest user stack frame.
|
||||
- JSON writers receive the full traceback slice.
|
||||
- Internal `slog` frames and `runtime` frames are filtered out.
|
||||
- Internal `sneklog` frames and `runtime` frames are filtered out.
|
||||
|
||||
## Repository example
|
||||
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@ English version: [README.md](README.md)
|
||||
## Установка
|
||||
|
||||
```bash
|
||||
go get git.scuroneko.dev/scuroneko/slog/v2
|
||||
go get git.scuroneko.dev/scuroneko/sneklog/v2
|
||||
```
|
||||
|
||||
## Быстрый старт
|
||||
@@ -28,7 +28,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.scuroneko.dev/scuroneko/slog/v2"
|
||||
"git.scuroneko.dev/scuroneko/sneklog/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -146,7 +146,7 @@ logger.Infoln("login token:", "SOME_SECRET")
|
||||
|
||||
- Текстовые writer'ы используют ближайший пользовательский stack frame.
|
||||
- JSON writer'ы получают полный traceback.
|
||||
- Внутренние frame'ы `slog` и `runtime` фильтруются из traceback.
|
||||
- Внутренние frame'ы `sneklog` и `runtime` фильтруются из traceback.
|
||||
|
||||
## Пример из репозитория
|
||||
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
## Highlights
|
||||
|
||||
- Renamed the public Go package from `slog` to `sneklog` to avoid confusion with the standard library `log/slog` package.
|
||||
- Moved the module path to `git.scuroneko.dev/scuroneko/slog/v2` for Go module major-version compatibility.
|
||||
- Moved the module path to `git.scuroneko.dev/scuroneko/sneklog/v2` for Go module major-version compatibility.
|
||||
- Replaced fixed text writer settings with formatter-based output customization.
|
||||
- Added built-in ANSI color support and removed the external `github.com/fatih/color` dependency tree.
|
||||
- Formatters: a new way do display your logs!
|
||||
@@ -13,7 +13,7 @@
|
||||
- Import paths must use the `/v2` module suffix:
|
||||
|
||||
```go
|
||||
import sneklog "git.scuroneko.dev/scuroneko/slog/v2"
|
||||
import "git.scuroneko.dev/scuroneko/sneklog/v2"
|
||||
```
|
||||
|
||||
- Package references should use `sneklog` instead of `slog`.
|
||||
@@ -76,7 +76,7 @@ text := logger.CreateTextStdoutWriter()
|
||||
After:
|
||||
|
||||
```go
|
||||
import sneklog "git.scuroneko.dev/scuroneko/slog/v2"
|
||||
import sneklog "git.scuroneko.dev/scuroneko/sneklog/v2"
|
||||
|
||||
logger := sneklog.CreateLogger().
|
||||
Prefix("API").
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"git.scuroneko.dev/scuroneko/slog/v2"
|
||||
"git.scuroneko.dev/scuroneko/sneklog/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module git.scuroneko.dev/scuroneko/slog/v2
|
||||
module git.scuroneko.dev/scuroneko/sneklog/v2
|
||||
|
||||
go 1.26
|
||||
|
||||
+3
-3
@@ -275,7 +275,7 @@ func TestCreateJsonStdoutWriterDoesNotCloseStdout(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetFullTracebackSkipsRuntimeAndSlogFrames(t *testing.T) {
|
||||
func TestGetFullTracebackSkipsRuntimeAndSneklogFrames(t *testing.T) {
|
||||
tracebacks := captureTracebackForTest()
|
||||
if len(tracebacks) == 0 {
|
||||
t.Fatal("expected at least one traceback frame")
|
||||
@@ -290,7 +290,7 @@ func TestGetFullTracebackSkipsRuntimeAndSlogFrames(t *testing.T) {
|
||||
t.Fatalf("runtime frame should be filtered out, got %s", tb.Signature)
|
||||
}
|
||||
if _, ok := internalTracebackMethods[tb.Method]; ok {
|
||||
t.Fatalf("internal slog frame should be filtered out, got %s", tb.Signature)
|
||||
t.Fatalf("internal sneklog frame should be filtered out, got %s", tb.Signature)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ func TestGetTracebackReturnsNearestUserFrame(t *testing.T) {
|
||||
t.Fatalf("runtime frame should be filtered out, got %s", tb.Signature)
|
||||
}
|
||||
if _, ok := internalTracebackMethods[tb.Method]; ok {
|
||||
t.Fatalf("internal slog frame should be filtered out, got %s", tb.Signature)
|
||||
t.Fatalf("internal sneklog frame should be filtered out, got %s", tb.Signature)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user