1
0
Fork 0

fix: otel not working without USER

This commit is contained in:
Michael 2025-10-03 14:48:04 +02:00 committed by GitHub
parent ad566ee9ef
commit c5ed376d5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
127 changed files with 347 additions and 305 deletions

View file

@ -1,32 +0,0 @@
package logs
import (
"context"
"github.com/http-wasm/http-wasm-host-go/api"
"github.com/rs/zerolog"
)
// compile-time check to ensure ConsoleLogger implements api.Logger.
var _ api.Logger = WasmLogger{}
// WasmLogger is a convenience which writes anything above LogLevelInfo to os.Stdout.
type WasmLogger struct {
logger *zerolog.Logger
}
func NewWasmLogger(logger *zerolog.Logger) *WasmLogger {
return &WasmLogger{
logger: logger,
}
}
// IsEnabled implements the same method as documented on api.Logger.
func (w WasmLogger) IsEnabled(level api.LogLevel) bool {
return true
}
// Log implements the same method as documented on api.Logger.
func (w WasmLogger) Log(_ context.Context, level api.LogLevel, message string) {
w.logger.WithLevel(zerolog.Level(level + 1)).Msg(message)
}