mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 17:52:24 +00:00
- Modify .luarc.json to include global Lua scripts. - Update Makefile to include LDFLAGS for versioning. - Enhance node.go to implement version checking and update handling. - Refactor Lua global variables in _globals.lua and echo.lua to use new structures. - Remove deprecated http.lua and update config.yaml for TLS and update settings. - Introduce new update.go for version management and update checking. - Add tests for version comparison in update_test.go. - Improve error handling in various server methods.
36 lines
572 B
Go
36 lines
572 B
Go
package logs
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
"sync"
|
|
)
|
|
|
|
type MockHandler struct {
|
|
mu sync.Mutex
|
|
Logs []slog.Record
|
|
}
|
|
|
|
func NewMockHandler() *MockHandler {
|
|
return &MockHandler{}
|
|
}
|
|
|
|
func (h *MockHandler) Enabled(_ context.Context, _ slog.Level) bool {
|
|
return true
|
|
}
|
|
|
|
func (h *MockHandler) Handle(_ context.Context, r slog.Record) error {
|
|
h.mu.Lock()
|
|
defer h.mu.Unlock()
|
|
h.Logs = append(h.Logs, r.Clone())
|
|
return nil
|
|
}
|
|
|
|
func (h *MockHandler) WithAttrs(_ []slog.Attr) slog.Handler {
|
|
return h
|
|
}
|
|
|
|
func (h *MockHandler) WithGroup(_ string) slog.Handler {
|
|
return h
|
|
}
|