Jobs & Workflows https://armen.surge.sh
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
1.5 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### cli ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package cli
import "forge.chapril.org/armen/armen/internal/components"
func adminListLogger(ccs *components.Components) error {
requestor, err := newRequestor(ccs)
if err != nil {
return err
}
all, err := requestor.AdminListLogger()
if err != nil {
return err
}
return displayResult(all)
}
func adminSetLoggerLevel(args []string, ccs *components.Components) error {
if len(args) < 2 {
help()
return _errArgs
}
fs := newFlagSet(ccs)
var id string
var level string
fs.StringVar(&id, "id", "", "")
fs.StringVar(&level, "level", "", "")
if err := fs.Parse(args); err != nil {
return err
}
requestor, err := newRequestor(ccs)
if err != nil {
return err
}
return requestor.AdminSetLoggerLevel(id, level)
}
func logger(args []string, ccs *components.Components) error {
if len(args) < 1 {
help()
return _errArgs
}
arg := args[0]
args = args[1:]
switch arg {
case "list":
return adminListLogger(ccs)
case "setlevel":
return adminSetLoggerLevel(args, ccs)
default:
help()
}
return nil
}
/*
######################################################################################################## @(°_°)@ #######
*/