123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- package log
- import (
- "context"
- "io"
- )
- // Fatal calls the default logger's Fatal method and then os.Exit(1).
- func Fatal(v ...interface{}) {
- logger.Fatal(v...)
- }
- // Error calls the default logger's Error method.
- func Error(v ...interface{}) {
- logger.Error(v...)
- }
- // Warn calls the default logger's Warn method.
- func Warn(v ...interface{}) {
- logger.Warn(v...)
- }
- // Info calls the default logger's Info method.
- func Info(v ...interface{}) {
- logger.Info(v...)
- }
- // Debug calls the default logger's Debug method.
- func Debug(v ...interface{}) {
- logger.Debug(v...)
- }
- // Trace calls the default logger's Trace method.
- func Trace(v ...interface{}) {
- logger.Trace(v...)
- }
- // Panic calls the default logger's Panic method.
- func Panic(v ...interface{}) {
- logger.Panic(v...)
- }
- // Fatalf calls the default logger's Fatalf method and then os.Exit(1).
- func Fatalf(format string, v ...interface{}) {
- logger.Fatalf(format, v...)
- }
- // Errorf calls the default logger's Errorf method.
- func Errorf(format string, v ...interface{}) {
- logger.Errorf(format, v...)
- }
- // Warnf calls the default logger's Warnf method.
- func Warnf(format string, v ...interface{}) {
- logger.Warnf(format, v...)
- }
- // Infof calls the default logger's Infof method.
- func Infof(format string, v ...interface{}) {
- logger.Infof(format, v...)
- }
- // Debugf calls the default logger's Debugf method.
- func Debugf(format string, v ...interface{}) {
- logger.Debugf(format, v...)
- }
- // Tracef calls the default logger's Tracef method.
- func Tracef(format string, v ...interface{}) {
- logger.Tracef(format, v...)
- }
- // Panicf calls the default logger's Tracef method.
- func Panicf(format string, v ...interface{}) {
- logger.Panicf(format, v...)
- }
- // Tracew logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Tracew(msg string, keysAndValues ...interface{}) {
- logger.Tracew(msg, keysAndValues...)
- }
- // Debugw logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Debugw(msg string, keysAndValues ...interface{}) {
- logger.Debugw(msg, keysAndValues...)
- }
- // Infow logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Infow(msg string, keysAndValues ...interface{}) {
- logger.Infow(msg, keysAndValues...)
- }
- // Warnw logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Warnw(msg string, keysAndValues ...interface{}) {
- logger.Warnw(msg, keysAndValues...)
- }
- // Errorw logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Errorw(msg string, keysAndValues ...interface{}) {
- logger.Errorw(msg, keysAndValues...)
- }
- // Fatalw logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Fatalw(msg string, keysAndValues ...interface{}) {
- logger.Fatalw(msg, keysAndValues...)
- }
- // Panicw logs a message with some additional context. The variadic key-value
- // pairs are treated as they are privateLog With.
- func Panicw(msg string, keysAndValues ...interface{}) {
- logger.Panicw(msg, keysAndValues...)
- }
- func WithContext(ctx context.Context) CommonLogger {
- return logger.WithContext(ctx)
- }
- // SetLogger sets the default logger and the system logger.
- // Note that this method is not concurrent-safe and must not be called
- // after the use of DefaultLogger and global functions privateLog this package.
- func SetLogger(v AllLogger) {
- logger = v
- }
- // SetOutput sets the output of default logger and system logger. By default, it is stderr.
- func SetOutput(w io.Writer) {
- logger.SetOutput(w)
- }
- // SetLevel sets the level of logs below which logs will not be output.
- // The default logger is LevelTrace.
- // Note that this method is not concurrent-safe.
- func SetLevel(lv Level) {
- logger.SetLevel(lv)
- }
|