Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default log level part of pelican config #236

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ func main() {
}

func handleCLI(args []string) error {
exec_name := filepath.Base(args[0])
execName := filepath.Base(args[0])
// Take care of our Windows users
exec_name = strings.TrimSuffix(exec_name, ".exe")
execName = strings.TrimSuffix(execName, ".exe")
// Being case-insensitive
exec_name = strings.ToLower(exec_name)
execName = strings.ToLower(execName)

if exec_name == "stash_plugin" || exec_name == "osdf_plugin" || exec_name == "pelican_xfer_plugin" {
if execName == "stash_plugin" || execName == "osdf_plugin" || execName == "pelican_xfer_plugin" {
stashPluginMain(args[1:])
} else if exec_name == "stashcp" {
} else if execName == "stashcp" {
err := copyCmd.Execute()
if err != nil {
return err
Expand Down
7 changes: 6 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ func InitConfig() {
if param.Debug.GetBool() {
SetLogging(log.DebugLevel)
} else {
SetLogging(log.ErrorLevel)
logLevel := param.Logging_Level.GetString()
level, err := log.ParseLevel(logLevel)
if err != nil {
cobra.CheckErr(err)
}
SetLogging(level)
}
}

Expand Down
3 changes: 2 additions & 1 deletion config/resources/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#

Debug: false

Logging:
Level: "Error"
Server:
Port: 8444
Address: "0.0.0.0"
Expand Down
11 changes: 11 additions & 0 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ default: 10s
components: ["client", "nsregistry", "origin"]
---

############################
# Log-Level Configs #
############################
name: Logging.Level
description: >-
A string defining the log level of the client. Options include (going from most info to least): Trace, Debug, Info, Warn, Error, Fatal, Panic.
type: string
default: Error
components: ["*"]
---

############################
# Federation-Level Configs #
############################
Expand Down
Loading