summaryrefslogtreecommitdiff
path: root/plugins/server
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-13 17:15:00 +0300
committerValery Piashchynski <[email protected]>2021-05-13 17:15:00 +0300
commit2be94ad0400e2f523d87f47e09a7bf505edef689 (patch)
tree1824c8ee28d0c6ce2884b99d0a4eaa99dcaa9cbb /plugins/server
parent705b69631dc91323c64a19594dcfeca06ea4fa5a (diff)
- Remove unsafe casting (replace with a less unsafe)
- Make the static plugin great again (separate plugin) - Revert new behavior Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/server')
-rw-r--r--plugins/server/plugin.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index 22b568d8..320da372 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"
@@ -239,10 +238,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 +252,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))
-}