summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-04-04 19:31:06 +0300
committerValery Piashchynski <[email protected]>2021-04-04 19:31:06 +0300
commitc6b123af6464c3c6fd79bf1fc28da71c300eb7b3 (patch)
treeed9c1f087e68a2c70ac002466c233469563fc5e9 /plugins
parent10a153e9df62bcbdf77c5b5a63daf5ea7b792495 (diff)
- Update CHANGELOG
- Check log event by logger (mocked) - Modify Stderr event to be as INFO Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/logger/config.go2
-rw-r--r--plugins/server/plugin.go18
2 files changed, 13 insertions, 7 deletions
diff --git a/plugins/logger/config.go b/plugins/logger/config.go
index bfe45f78..eee5fb71 100644
--- a/plugins/logger/config.go
+++ b/plugins/logger/config.go
@@ -52,7 +52,7 @@ func (cfg *Config) BuildLogger() (*zap.Logger, error) {
zCfg = zap.NewDevelopmentConfig()
case "raw":
zCfg = zap.Config{
- Level: zap.NewAtomicLevelAt(zap.DebugLevel),
+ Level: zap.NewAtomicLevelAt(zap.InfoLevel),
Encoding: "console",
EncoderConfig: zapcore.EncoderConfig{
MessageKey: "message",
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index f708b15e..c3496ae7 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"strings"
+ "unsafe"
"github.com/spiral/errors"
"github.com/spiral/roadrunner/v2/pkg/transport"
@@ -234,10 +235,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(string(we.Payload.([]byte)), " \n\t"))
+ server.log.Debug(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
+ // stderr event is INFO level
case events.EventWorkerStderr:
- // TODO unsafe byte to string convert
- server.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"))
+ server.log.Info(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
}
}
}
@@ -248,10 +249,15 @@ 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(string(we.Payload.([]byte)), " \n\t"))
+ server.log.Debug(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
+ // stderr event is INFO level
case events.EventWorkerStderr:
- // TODO unsafe byte to string convert
- server.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"))
+ server.log.Info(strings.TrimRight(toString(we.Payload.([]byte)), " \n\t"))
}
}
}
+
+// unsafe, but lightning fast []byte to string conversion
+func toString(data []byte) string {
+ return *(*string)(unsafe.Pointer(&data))
+}