istio.io/istio@v0.0.0-20240520182934-d79c90f27776/istioctl/pkg/root/root.go (about) 1 // Copyright Istio Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package root 16 17 import ( 18 "istio.io/istio/pkg/env" 19 "istio.io/istio/pkg/log" 20 ) 21 22 const ( 23 // Location to read istioctl defaults from 24 defaultIstioctlConfig = "$HOME/.istioctl/config.yaml" 25 ) 26 27 var ( 28 // IstioConfig is the name of the istioctl config file (if any) 29 IstioConfig = env.Register("ISTIOCONFIG", defaultIstioctlConfig, 30 "Default values for istioctl flags").Get() 31 32 LoggingOptions = defaultLogOptions() 33 34 // scope is for dev logging. Warning: log levels are not set by --log_output_level until command is Run(). 35 Scope = log.RegisterScope("cli", "istioctl") 36 ) 37 38 func defaultLogOptions() *log.Options { 39 o := log.DefaultOptions() 40 // Default to warning for everything; we usually don't want logs in istioctl 41 o.SetDefaultOutputLevel("all", log.WarnLevel) 42 // These scopes are too noisy even at warning level 43 o.SetDefaultOutputLevel("validation", log.ErrorLevel) 44 o.SetDefaultOutputLevel("processing", log.ErrorLevel) 45 o.SetDefaultOutputLevel("kube", log.ErrorLevel) 46 return o 47 }