github.com/kubevela/workflow@v0.6.0/pkg/common/logs.go (about) 1 /* 2 Copyright 2022 The KubeVela Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package common 18 19 import "k8s.io/klog/v2" 20 21 // klog has multiple levels, you can set the log levels by klog.V() 22 // Basic examples: 23 // 24 // klog.V(1).Info("Prepare to repel boarders") 25 // 26 // klog.V(2).ErrorS(err, "Initialization failed") 27 const ( 28 // LogInfo level is for most info logs, this is the default 29 // One should just call Info directly. 30 LogInfo klog.Level = iota 31 32 // LogDebug is for more verbose logs 33 LogDebug 34 35 // LogDebugWithContent is recommended if one wants to log with the content of the object, 36 // ie. http body, json/yaml file content 37 LogDebugWithContent 38 39 // LogTrace is the most verbose log level, don't add anything after this 40 LogTrace = 100 41 )