summaryrefslogtreecommitdiff
path: root/plugins/logger
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/logger')
-rw-r--r--plugins/logger/interface.go2
-rw-r--r--plugins/logger/std_log_adapter.go9
2 files changed, 3 insertions, 8 deletions
diff --git a/plugins/logger/interface.go b/plugins/logger/interface.go
index 5bb2143b..827f9821 100644
--- a/plugins/logger/interface.go
+++ b/plugins/logger/interface.go
@@ -8,7 +8,7 @@ type Logger interface {
Error(msg string, keyvals ...interface{})
}
-// With creates a child logger and adds structured context to it
+// WithLogger creates a child logger and adds structured context to it
type WithLogger interface {
With(keyvals ...interface{}) Logger
}
diff --git a/plugins/logger/std_log_adapter.go b/plugins/logger/std_log_adapter.go
index 484cc23e..479aa565 100644
--- a/plugins/logger/std_log_adapter.go
+++ b/plugins/logger/std_log_adapter.go
@@ -1,7 +1,7 @@
package logger
import (
- "unsafe"
+ "github.com/spiral/roadrunner/v2/utils"
)
// StdLogAdapter can be passed to the http.Server or any place which required standard logger to redirect output
@@ -12,7 +12,7 @@ type StdLogAdapter struct {
// Write io.Writer interface implementation
func (s *StdLogAdapter) Write(p []byte) (n int, err error) {
- s.log.Error("server internal error", "message", toString(p))
+ s.log.Error("server internal error", "message", utils.AsString(p))
return len(p), nil
}
@@ -24,8 +24,3 @@ func NewStdAdapter(log Logger) *StdLogAdapter {
return logAdapter
}
-
-// unsafe, but lightning fast []byte to string conversion
-func toString(data []byte) string {
- return *(*string)(unsafe.Pointer(&data))
-}