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