github.com/zhongdalu/gf@v1.0.0/g/os/glog/glog_chaining.go (about) 1 // Copyright 2017 gf Author(https://github.com/zhongdalu/gf). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/zhongdalu/gf. 6 7 package glog 8 9 import ( 10 "io" 11 ) 12 13 // Expose returns the default logger of glog. 14 func Expose() *Logger { 15 return logger 16 } 17 18 // To is a chaining function, 19 // which redirects current logging content output to the sepecified <writer>. 20 func To(writer io.Writer) *Logger { 21 return logger.To(writer) 22 } 23 24 // Path is a chaining function, 25 // which sets the directory path to <path> for current logging content output. 26 func Path(path string) *Logger { 27 return logger.Path(path) 28 } 29 30 // Cat is a chaining function, 31 // which sets the category to <category> for current logging content output. 32 func Cat(category string) *Logger { 33 return logger.Cat(category) 34 } 35 36 // File is a chaining function, 37 // which sets file name <pattern> for the current logging content output. 38 func File(pattern string) *Logger { 39 return logger.File(pattern) 40 } 41 42 // Level is a chaining function, 43 // which sets logging level for the current logging content output. 44 func Level(level int) *Logger { 45 return logger.Level(level) 46 } 47 48 // Skip is a chaining function, 49 // which sets stack skip for the current logging content output. 50 // It also affects the caller file path checks when line number printing enabled. 51 func Skip(skip int) *Logger { 52 return logger.Skip(skip) 53 } 54 55 // Stack is a chaining function, 56 // which sets stack options for the current logging content output . 57 func Stack(enabled bool, skip ...int) *Logger { 58 return logger.Stack(enabled, skip...) 59 } 60 61 // StdPrint is a chaining function, 62 // which enables/disables stdout for the current logging content output. 63 // It's enabled in default. 64 func Stdout(enabled ...bool) *Logger { 65 return logger.Stdout(enabled...) 66 } 67 68 // Header is a chaining function, 69 // which enables/disables log header for the current logging content output. 70 // It's enabled in default. 71 func Header(enabled ...bool) *Logger { 72 return logger.Header(enabled...) 73 } 74 75 // Line is a chaining function, 76 // which enables/disables printing its caller file along with its line number. 77 // The parameter <long> specified whether print the long absolute file path, eg: /a/b/c/d.go:23. 78 func Line(long ...bool) *Logger { 79 return logger.Line(long...) 80 } 81 82 // Async is a chaining function, 83 // which enables/disables async logging output feature. 84 func Async(enabled ...bool) *Logger { 85 return logger.Async(enabled...) 86 }