summaryrefslogtreecommitdiff
path: root/plugins/server
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/server')
-rw-r--r--plugins/server/config.go2
-rw-r--r--plugins/server/plugin.go17
2 files changed, 6 insertions, 13 deletions
diff --git a/plugins/server/config.go b/plugins/server/config.go
index a4b0d91c..00ce4140 100644
--- a/plugins/server/config.go
+++ b/plugins/server/config.go
@@ -4,7 +4,7 @@ import (
"time"
)
-// All config (.rr.yaml)
+// Config All config (.rr.yaml)
// For other section use pointer to distinguish between `empty` and `not present`
type Config struct {
// Server config section
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index 22b568d8..ef77f7ab 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"strings"
- "unsafe"
"github.com/spiral/errors"
"github.com/spiral/roadrunner/v2/pkg/transport"
@@ -59,8 +58,7 @@ func (server *Plugin) Name() string {
}
// Available interface implementation
-func (server *Plugin) Available() {
-}
+func (server *Plugin) Available() {}
// Serve (Start) server plugin (just a mock here to satisfy interface)
func (server *Plugin) Serve() chan error {
@@ -239,10 +237,10 @@ func (server *Plugin) collectEvents(event interface{}) {
case events.EventWorkerError:
server.log.Error(strings.TrimRight(we.Payload.(error).Error(), " \n\t"))
case events.EventWorkerLog:
- server.log.Debug(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
+ server.log.Debug(strings.TrimRight(utils.AsString(we.Payload.([]byte)), " \n\t"))
// stderr event is INFO level
case events.EventWorkerStderr:
- server.log.Info(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
+ server.log.Info(strings.TrimRight(utils.AsString(we.Payload.([]byte)), " \n\t"))
}
}
}
@@ -253,15 +251,10 @@ func (server *Plugin) collectWorkerLogs(event interface{}) {
case events.EventWorkerError:
server.log.Error(strings.TrimRight(we.Payload.(error).Error(), " \n\t"))
case events.EventWorkerLog:
- server.log.Debug(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
+ server.log.Debug(strings.TrimRight(utils.AsString(we.Payload.([]byte)), " \n\t"))
// stderr event is INFO level
case events.EventWorkerStderr:
- server.log.Info(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
+ server.log.Info(strings.TrimRight(utils.AsString(we.Payload.([]byte)), " \n\t"))
}
}
}
-
-// unsafe, but lightning fast []byte to string conversion
-func toString(data []byte) string {
- return *(*string)(unsafe.Pointer(&data))
-}