mirror of
https://github.com/wneessen/logranger.git
synced 2024-11-22 04:40:49 +01:00
Winni Neessen
670e5b1d30
Refactored the Action interface in the plugins package to separate the configuration step from the process method. The new Config method accepts a configuration map and returns an error. The modified server.go uses this Config method to apply configurations before calling Process. File action plugin specifically has been updated to support this new interface where configurations are now updated via Config method before invoking Process.
19 lines
552 B
Go
19 lines
552 B
Go
// SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package plugins
|
|
|
|
import (
|
|
"github.com/wneessen/go-parsesyslog"
|
|
)
|
|
|
|
// Action is an interface that defines the behavior of an action to be performed
|
|
// on a log message.
|
|
//
|
|
// The Process method takes a log message, a slice of match groups, and a
|
|
// configuration map, and returns an error if any occurs during processing.
|
|
type Action interface {
|
|
Config(confmap map[string]any) error
|
|
Process(logmessage parsesyslog.LogMsg, matchgroup []string) error
|
|
}
|