github.com/gogf/gf/v2@v2.7.4/os/glog/glog_api.go (about) 1 // Copyright GoFrame Author(https://goframe.org). 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/gogf/gf. 6 7 package glog 8 9 import "context" 10 11 // Print prints `v` with newline using fmt.Sprintln. 12 // The parameter `v` can be multiple variables. 13 func Print(ctx context.Context, v ...interface{}) { 14 defaultLogger.Print(ctx, v...) 15 } 16 17 // Printf prints `v` with format `format` using fmt.Sprintf. 18 // The parameter `v` can be multiple variables. 19 func Printf(ctx context.Context, format string, v ...interface{}) { 20 defaultLogger.Printf(ctx, format, v...) 21 } 22 23 // Fatal prints the logging content with [FATA] header and newline, then exit the current process. 24 func Fatal(ctx context.Context, v ...interface{}) { 25 defaultLogger.Fatal(ctx, v...) 26 } 27 28 // Fatalf prints the logging content with [FATA] header, custom format and newline, then exit the current process. 29 func Fatalf(ctx context.Context, format string, v ...interface{}) { 30 defaultLogger.Fatalf(ctx, format, v...) 31 } 32 33 // Panic prints the logging content with [PANI] header and newline, then panics. 34 func Panic(ctx context.Context, v ...interface{}) { 35 defaultLogger.Panic(ctx, v...) 36 } 37 38 // Panicf prints the logging content with [PANI] header, custom format and newline, then panics. 39 func Panicf(ctx context.Context, format string, v ...interface{}) { 40 defaultLogger.Panicf(ctx, format, v...) 41 } 42 43 // Info prints the logging content with [INFO] header and newline. 44 func Info(ctx context.Context, v ...interface{}) { 45 defaultLogger.Info(ctx, v...) 46 } 47 48 // Infof prints the logging content with [INFO] header, custom format and newline. 49 func Infof(ctx context.Context, format string, v ...interface{}) { 50 defaultLogger.Infof(ctx, format, v...) 51 } 52 53 // Debug prints the logging content with [DEBU] header and newline. 54 func Debug(ctx context.Context, v ...interface{}) { 55 defaultLogger.Debug(ctx, v...) 56 } 57 58 // Debugf prints the logging content with [DEBU] header, custom format and newline. 59 func Debugf(ctx context.Context, format string, v ...interface{}) { 60 defaultLogger.Debugf(ctx, format, v...) 61 } 62 63 // Notice prints the logging content with [NOTI] header and newline. 64 // It also prints caller stack info if stack feature is enabled. 65 func Notice(ctx context.Context, v ...interface{}) { 66 defaultLogger.Notice(ctx, v...) 67 } 68 69 // Noticef prints the logging content with [NOTI] header, custom format and newline. 70 // It also prints caller stack info if stack feature is enabled. 71 func Noticef(ctx context.Context, format string, v ...interface{}) { 72 defaultLogger.Noticef(ctx, format, v...) 73 } 74 75 // Warning prints the logging content with [WARN] header and newline. 76 // It also prints caller stack info if stack feature is enabled. 77 func Warning(ctx context.Context, v ...interface{}) { 78 defaultLogger.Warning(ctx, v...) 79 } 80 81 // Warningf prints the logging content with [WARN] header, custom format and newline. 82 // It also prints caller stack info if stack feature is enabled. 83 func Warningf(ctx context.Context, format string, v ...interface{}) { 84 defaultLogger.Warningf(ctx, format, v...) 85 } 86 87 // Error prints the logging content with [ERRO] header and newline. 88 // It also prints caller stack info if stack feature is enabled. 89 func Error(ctx context.Context, v ...interface{}) { 90 defaultLogger.Error(ctx, v...) 91 } 92 93 // Errorf prints the logging content with [ERRO] header, custom format and newline. 94 // It also prints caller stack info if stack feature is enabled. 95 func Errorf(ctx context.Context, format string, v ...interface{}) { 96 defaultLogger.Errorf(ctx, format, v...) 97 } 98 99 // Critical prints the logging content with [CRIT] header and newline. 100 // It also prints caller stack info if stack feature is enabled. 101 func Critical(ctx context.Context, v ...interface{}) { 102 defaultLogger.Critical(ctx, v...) 103 } 104 105 // Criticalf prints the logging content with [CRIT] header, custom format and newline. 106 // It also prints caller stack info if stack feature is enabled. 107 func Criticalf(ctx context.Context, format string, v ...interface{}) { 108 defaultLogger.Criticalf(ctx, format, v...) 109 }