github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/utils/utils.go (about) 1 // Unless explicitly stated otherwise all files in this repository are licensed 2 // under the MIT License. 3 // This product includes software developed at Guance Cloud (https://www.guance.com/). 4 // Copyright 2021-present Guance, Inc. 5 6 // Package utils wraps utilities used by pipeline 7 package utils 8 9 import ( 10 "os" 11 12 "github.com/GuanceCloud/cliutils/point" 13 ) 14 15 func PtCatOption(cat point.Category) []point.Option { 16 var opt []point.Option 17 switch cat { 18 case point.Logging, point.DialTesting: 19 opt = point.DefaultLoggingOptions() 20 case point.Tracing, 21 point.Network, 22 point.KeyEvent, 23 point.RUM, 24 point.Security, 25 point.Profiling: 26 opt = point.CommonLoggingOptions() 27 case point.Object, 28 point.CustomObject: 29 opt = point.DefaultObjectOptions() 30 case point.Metric: 31 opt = point.DefaultMetricOptions() 32 33 case point.DynamicDWCategory, 34 point.MetricDeprecated, 35 point.UnknownCategory: // pass 36 37 default: 38 } 39 return opt 40 } 41 42 func FileExist(filename string) bool { 43 _, err := os.Stat(filename) 44 return err == nil || os.IsExist(err) 45 }