mirror of
https://github.com/wneessen/logranger.git
synced 2024-11-23 05:10:50 +01:00
Winni Neessen
b6f6b6a664
Introduced an Actions interface for plugins in 'action.go' and implemented a corresponding registry in 'registry.go'. Additionally, adjusted rule related behavior in 'Server' to account for actions, with relevant new fields in Ruleset and Rule. This enables multiple actions on a log message based on defined rules and further modularises the codebase, paving the path for addition of more plugin actions.
17 lines
592 B
Go
17 lines
592 B
Go
// SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package actions
|
|
|
|
import (
|
|
"github.com/wneessen/logranger/plugins"
|
|
)
|
|
|
|
// Actions is a variable that represents a map of string keys to Action values. The keys are used to identify different actions, and the corresponding values are the functions that define
|
|
var Actions = map[string]plugins.Action{}
|
|
|
|
// Add adds an action with the given name to the Actions map. The action function must implement the Action interface.
|
|
func Add(name string, action plugins.Action) {
|
|
Actions[name] = action
|
|
}
|