common

package
v0.22.9-patch-1-epoch-... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetLogLevelCommand commands.AdminCommand = commands.AdminCommand{
	Handler: func(ctx context.Context, req *admin.CommandRequest) error {
		level := req.ValidatorData.(zerolog.Level)
		zerolog.SetGlobalLevel(level)
		return nil
	},
	Validator: func(req *admin.CommandRequest) error {
		level, ok := req.Data["level"]
		if !ok {
			return errors.New("the \"level\" field must be provided")
		}
		levelStr, ok := level.(string)
		if !ok {
			return errors.New("\"level\" must be a string")
		}
		logLevel, err := zerolog.ParseLevel(levelStr)
		if err != nil {
			return fmt.Errorf("failed to parse level: %w", err)
		}
		req.ValidatorData = logLevel
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL