gf/os/glog/glog_api.go

110 lines
3.9 KiB
Go
Raw Normal View History

2021-01-17 21:46:25 +08:00
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2019-05-21 23:57:03 +08:00
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package glog
2021-09-27 21:27:24 +08:00
import "context"
2021-08-08 13:56:26 +08:00
// Print prints `v` with newline using fmt.Sprintln.
// The parameter `v` can be multiple variables.
2021-09-27 21:27:24 +08:00
func Print(ctx context.Context, v ...interface{}) {
logger.Print(ctx, v...)
2019-05-21 23:57:03 +08:00
}
2021-08-08 13:56:26 +08:00
// Printf prints `v` with format `format` using fmt.Sprintf.
// The parameter `v` can be multiple variables.
2021-09-27 21:27:24 +08:00
func Printf(ctx context.Context, format string, v ...interface{}) {
logger.Printf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
// Fatal prints the logging content with [FATA] header and newline, then exit the current process.
2021-09-27 21:27:24 +08:00
func Fatal(ctx context.Context, v ...interface{}) {
logger.Fatal(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Fatalf prints the logging content with [FATA] header, custom format and newline, then exit the current process.
2021-09-27 21:27:24 +08:00
func Fatalf(ctx context.Context, format string, v ...interface{}) {
logger.Fatalf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Panic prints the logging content with [PANI] header and newline, then panics.
2021-09-27 21:27:24 +08:00
func Panic(ctx context.Context, v ...interface{}) {
logger.Panic(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Panicf prints the logging content with [PANI] header, custom format and newline, then panics.
2021-09-27 21:27:24 +08:00
func Panicf(ctx context.Context, format string, v ...interface{}) {
logger.Panicf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Info prints the logging content with [INFO] header and newline.
2021-09-27 21:27:24 +08:00
func Info(ctx context.Context, v ...interface{}) {
logger.Info(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Infof prints the logging content with [INFO] header, custom format and newline.
2021-09-27 21:27:24 +08:00
func Infof(ctx context.Context, format string, v ...interface{}) {
logger.Infof(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Debug prints the logging content with [DEBU] header and newline.
2021-09-27 21:27:24 +08:00
func Debug(ctx context.Context, v ...interface{}) {
logger.Debug(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Debugf prints the logging content with [DEBU] header, custom format and newline.
2021-09-27 21:27:24 +08:00
func Debugf(ctx context.Context, format string, v ...interface{}) {
logger.Debugf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Notice prints the logging content with [NOTI] header and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Notice(ctx context.Context, v ...interface{}) {
logger.Notice(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Noticef prints the logging content with [NOTI] header, custom format and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Noticef(ctx context.Context, format string, v ...interface{}) {
logger.Noticef(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Warning prints the logging content with [WARN] header and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Warning(ctx context.Context, v ...interface{}) {
logger.Warning(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Warningf prints the logging content with [WARN] header, custom format and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Warningf(ctx context.Context, format string, v ...interface{}) {
logger.Warningf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Error prints the logging content with [ERRO] header and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Error(ctx context.Context, v ...interface{}) {
logger.Error(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Errorf prints the logging content with [ERRO] header, custom format and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Errorf(ctx context.Context, format string, v ...interface{}) {
logger.Errorf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}
2019-05-22 20:31:14 +08:00
// Critical prints the logging content with [CRIT] header and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Critical(ctx context.Context, v ...interface{}) {
logger.Critical(ctx, v...)
2019-05-21 23:57:03 +08:00
}
// Criticalf prints the logging content with [CRIT] header, custom format and newline.
// It also prints caller stack info if stack feature is enabled.
2021-09-27 21:27:24 +08:00
func Criticalf(ctx context.Context, format string, v ...interface{}) {
logger.Criticalf(ctx, format, v...)
2019-05-21 23:57:03 +08:00
}