Move packages to root folder
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 33s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 33s
Signed-off-by: Jan Tytgat <jan.tytgat@corelayer.eu>
This commit is contained in:
35
application/logging.go
Normal file
35
application/logging.go
Normal file
@ -0,0 +1,35 @@
|
||||
package application
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const (
|
||||
LogOutputStdOut = "stdout"
|
||||
LogOutputStdErr = "stderr"
|
||||
LogOutputFile = "file"
|
||||
)
|
||||
|
||||
var logLevelFlag string
|
||||
var logOutputFlag string
|
||||
var logTypeFlag string
|
||||
|
||||
func addLogLevelFlag(cmd *cobra.Command) {
|
||||
cmd.PersistentFlags().StringVarP(&logLevelFlag, "log-level", "", "info", "Set log level (trace, debug, info, warn, error, fatal)")
|
||||
}
|
||||
|
||||
func addLogOutputFlag(cmd *cobra.Command) {
|
||||
cmd.PersistentFlags().StringVarP(&logOutputFlag, "log-outWriter", "", "stderr", "Set log outWriter (stdout, stderr, file)")
|
||||
}
|
||||
|
||||
func addLogTypeFlag(cmd *cobra.Command) {
|
||||
cmd.PersistentFlags().StringVarP(&logTypeFlag, "log-type", "", "text", "Set log type (text, json, color)")
|
||||
}
|
||||
|
||||
func configureLoggingFlags(cmd *cobra.Command) {
|
||||
addLogLevelFlag(cmd)
|
||||
addLogOutputFlag(cmd)
|
||||
addLogTypeFlag(cmd)
|
||||
|
||||
cmd.MarkFlagsMutuallyExclusive("no-color", "log-type")
|
||||
}
|
Reference in New Issue
Block a user