diff options
author | Valery Piashchynski <[email protected]> | 2021-09-16 17:12:37 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-16 17:12:37 +0300 |
commit | f3491c089b4da77fd8d2bc942a88b6b8d117a8a5 (patch) | |
tree | 32bfffb1f24eeee7b909747cc00a6a6b9fd3ee83 /tests/plugins/logger/plugin.go | |
parent | 5d2cd55ab522d4f1e65a833f91146444465a32ac (diff) |
Move plugins to a separate repository
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/logger/plugin.go')
-rw-r--r-- | tests/plugins/logger/plugin.go | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/tests/plugins/logger/plugin.go b/tests/plugins/logger/plugin.go deleted file mode 100644 index 54e78d7b..00000000 --- a/tests/plugins/logger/plugin.go +++ /dev/null @@ -1,71 +0,0 @@ -package logger - -import ( - "strings" - - "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/plugins/config" - "github.com/spiral/roadrunner/v2/plugins/logger" - "go.uber.org/zap" - core "go.uber.org/zap/zapcore" -) - -type Plugin struct { - config config.Configurer - log logger.Logger -} - -type Loggable struct { -} - -func (l *Loggable) MarshalLogObject(encoder core.ObjectEncoder) error { - encoder.AddString("error", "Example marshaller error") - return nil -} - -func (p1 *Plugin) Init(cfg config.Configurer, log logger.Logger) error { - p1.config = cfg - p1.log = log - return nil -} - -func (p1 *Plugin) Serve() chan error { - errCh := make(chan error, 1) - p1.log.Error("error", "test", errors.E(errors.Str("test"))) - p1.log.Info("error", "test", errors.E(errors.Str("test"))) - p1.log.Debug("error", "test", errors.E(errors.Str("test"))) - p1.log.Warn("error", "test", errors.E(errors.Str("test"))) - - field := zap.String("error", "Example field error") - - p1.log.Error("error", field) - p1.log.Info("error", field) - p1.log.Debug("error", field) - p1.log.Warn("error", field) - - marshalledObject := &Loggable{} - - p1.log.Error("error", marshalledObject) - p1.log.Info("error", marshalledObject) - p1.log.Debug("error", marshalledObject) - p1.log.Warn("error", marshalledObject) - - p1.log.Error("error", "test") - p1.log.Info("error", "test") - p1.log.Debug("error", "test") - p1.log.Warn("error", "test") - - // test the `raw` mode - messageJSON := []byte(`{"field": "value"}`) - p1.log.Debug(strings.TrimRight(string(messageJSON), " \n\t")) - - return errCh -} - -func (p1 *Plugin) Stop() error { - return nil -} - -func (p1 *Plugin) Name() string { - return "logger_plugin" -} |