1package logger
2
3var externalValidators []LogOptValidator
4
5// RegisterExternalValidator adds the validator to the list of external validators.
6// External validators are used by packages outside this package that need to add their own validation logic.
7// This should only be called on package initialization.
8func RegisterExternalValidator(v LogOptValidator) {
9	externalValidators = append(externalValidators, v)
10}
11
12// AddBuiltinLogOpts updates the list of built-in log opts. This allows other packages to supplement additional log options
13// without having to register an actual log driver. This is used by things that are more proxy log drivers and should
14// not be exposed as a usable log driver to the API.
15// This should only be called on package initialization.
16func AddBuiltinLogOpts(opts map[string]bool) {
17	for k, v := range opts {
18		builtInLogOpts[k] = v
19	}
20}
21
22func validateExternal(cfg map[string]string) error {
23	for _, v := range externalValidators {
24		if err := v(cfg); err != nil {
25			return err
26		}
27	}
28	return nil
29}
30