summaryrefslogtreecommitdiff
path: root/plugins/server/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/server/plugin.go')
-rw-r--r--plugins/server/plugin.go17
1 files changed, 5 insertions, 12 deletions
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))
-}