github.com/vedadiyan/sqlparser@v1.0.0/pkg/log/log.go (about) 1 /* 2 Copyright 2019 The Vitess 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 // You can modify this file to hook up a different logging library instead of glog. 18 // If you adapt to a different logging framework, you may need to use that 19 // framework's equivalent of *Depth() functions so the file and line number printed 20 // point to the real caller instead of your adapter function. 21 22 package log 23 24 import ( 25 "github.com/golang/glog" 26 "github.com/spf13/pflag" 27 ) 28 29 // Level is used with V() to test log verbosity. 30 type Level = glog.Level 31 32 var ( 33 // V quickly checks if the logging verbosity meets a threshold. 34 V = glog.V 35 36 // Flush ensures any pending I/O is written. 37 Flush = glog.Flush 38 39 // Info formats arguments like fmt.Print. 40 Info = glog.Info 41 // Infof formats arguments like fmt.Printf. 42 Infof = glog.Infof 43 // InfoDepth formats arguments like fmt.Print and uses depth to choose which call frame to log. 44 InfoDepth = glog.InfoDepth 45 46 // Warning formats arguments like fmt.Print. 47 Warning = glog.Warning 48 // Warningf formats arguments like fmt.Printf. 49 Warningf = glog.Warningf 50 // WarningDepth formats arguments like fmt.Print and uses depth to choose which call frame to log. 51 WarningDepth = glog.WarningDepth 52 53 // Error formats arguments like fmt.Print. 54 Error = glog.Error 55 // Errorf formats arguments like fmt.Printf. 56 Errorf = glog.Errorf 57 // ErrorDepth formats arguments like fmt.Print and uses depth to choose which call frame to log. 58 ErrorDepth = glog.ErrorDepth 59 60 // Exit formats arguments like fmt.Print. 61 Exit = glog.Exit 62 // Exitf formats arguments like fmt.Printf. 63 Exitf = glog.Exitf 64 // ExitDepth formats arguments like fmt.Print and uses depth to choose which call frame to log. 65 ExitDepth = glog.ExitDepth 66 67 // Fatal formats arguments like fmt.Print. 68 Fatal = glog.Fatal 69 // Fatalf formats arguments like fmt.Printf 70 Fatalf = glog.Fatalf 71 // FatalDepth formats arguments like fmt.Print and uses depth to choose which call frame to log. 72 FatalDepth = glog.FatalDepth 73 ) 74 75 // RegisterFlags installs log flags on the given FlagSet. 76 // 77 // `go/cmd/*` entrypoints should either use servenv.ParseFlags(WithArgs)? which 78 // calls this function, or call this function directly before parsing 79 // command-line arguments. 80 func RegisterFlags(fs *pflag.FlagSet) { 81 fs.Uint64Var(&glog.MaxSize, "log_rotate_max_size", glog.MaxSize, "size in bytes at which logs are rotated (glog.MaxSize)") 82 }