From 162e8f7e51d0df9036d9a44f49129f759ebc35c9 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 22 May 2019 20:31:14 +0800 Subject: [PATCH] comment updates for glog --- g/os/glog/glog_api.go | 120 +++++++++++++++++++++++------------ g/os/glog/glog_logger_api.go | 2 +- 2 files changed, 81 insertions(+), 41 deletions(-) diff --git a/g/os/glog/glog_api.go b/g/os/glog/glog_api.go index fa932bc07..1381b7e63 100644 --- a/g/os/glog/glog_api.go +++ b/g/os/glog/glog_api.go @@ -6,18 +6,25 @@ package glog +// Print prints with newline using fmt.Sprintln. +// The param can be multiple variables. func Print(v ...interface{}) { logger.Print(v ...) } +// Printf prints with format using fmt.Sprintf. +// The param can be multiple variables. func Printf(format string, v ...interface{}) { logger.Printf(format, v ...) } +// See Print. func Println(v ...interface{}) { logger.Println(v ...) } +// Printf prints with newline and format using fmt.Sprintf. +// The param can be multiple variables. func Printfln(format string, v ...interface{}) { logger.Printfln(format, v ...) } @@ -37,86 +44,119 @@ func Fatalfln(format string, v ...interface{}) { logger.Fatalfln(format, v ...) } +// Panic prints the logging content with [PANI] header and newline, then panics. func Panic(v ...interface{}) { logger.Panic(v ...) } +// Panicf prints the logging content with [PANI] header and custom format, then panics. func Panicf(format string, v ...interface{}) { logger.Panicf(format, v ...) } +// Panicfln prints the logging content with [PANI] header, newline and custom format, then panics. func Panicfln(format string, v ...interface{}) { logger.Panicfln(format, v ...) } +// Info prints the logging content with [INFO] header and newline. func Info(v ...interface{}) { logger.Info(v...) } +// Infof prints the logging content with [INFO] header and custom format. +func Infof(format string, v ...interface{}) { + logger.Infof(format, v...) +} + +// Infofln prints the logging content with [INFO] header, newline and custom format. +func Infofln(format string, v ...interface{}) { + logger.Infofln(format, v...) +} + +// Debug prints the logging content with [DEBU] header and newline. func Debug(v ...interface{}) { logger.Debug(v...) } +// Debugf prints the logging content with [DEBU] header and custom format. +func Debugf(format string, v ...interface{}) { + logger.Debugf(format, v...) +} + +// Debugfln prints the logging content with [DEBU] header, newline and custom format. +func Debugfln(format string, v ...interface{}) { + logger.Debugfln(format, v...) +} + +// Notice prints the logging content with [NOTI] header and newline. +// It also prints caller backtrace info if backtrace feature is enabled. func Notice(v ...interface{}) { logger.Notice(v...) } +// Noticef prints the logging content with [NOTI] header and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. +func Noticef(format string, v ...interface{}) { + logger.Noticef(format, v...) +} + +// Noticefln prints the logging content with [NOTI] header, newline and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. +func Noticefln(format string, v ...interface{}) { + logger.Noticefln(format, v...) +} + +// Warning prints the logging content with [WARN] header and newline. +// It also prints caller backtrace info if backtrace feature is enabled. func Warning(v ...interface{}) { logger.Warning(v...) } +// Warningf prints the logging content with [WARN] header and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. +func Warningf(format string, v ...interface{}) { + logger.Warningf(format, v...) +} + +// Warningfln prints the logging content with [WARN] header, newline and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. +func Warningfln(format string, v ...interface{}) { + logger.Warningfln(format, v...) +} + +// Error prints the logging content with [ERRO] header and newline. +// It also prints caller backtrace info if backtrace feature is enabled. func Error(v ...interface{}) { logger.Error(v...) } +// Errorf prints the logging content with [ERRO] header and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. +func Errorf(format string, v ...interface{}) { + logger.Errorf(format, v...) +} + +// Errorfln prints the logging content with [ERRO] header, newline and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. +func Errorfln(format string, v ...interface{}) { + logger.Errorfln(format, v...) +} + +// Critical prints the logging content with [CRIT] header and newline. +// It also prints caller backtrace info if backtrace feature is enabled. func Critical(v ...interface{}) { logger.Critical(v...) } -func Infof(format string, v ...interface{}) { - logger.Infof(format, v...) -} - -func Debugf(format string, v ...interface{}) { - logger.Debugf(format, v...) -} - -func Noticef(format string, v ...interface{}) { - logger.Noticef(format, v...) -} - -func Warningf(format string, v ...interface{}) { - logger.Warningf(format, v...) -} - -func Errorf(format string, v ...interface{}) { - logger.Errorf(format, v...) -} - +// Criticalf prints the logging content with [CRIT] header and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. func Criticalf(format string, v ...interface{}) { logger.Criticalf(format, v...) } -func Infofln(format string, v ...interface{}) { - logger.Infofln(format, v...) -} - -func Debugfln(format string, v ...interface{}) { - logger.Debugfln(format, v...) -} - -func Noticefln(format string, v ...interface{}) { - logger.Noticefln(format, v...) -} - -func Warningfln(format string, v ...interface{}) { - logger.Warningfln(format, v...) -} - -func Errorfln(format string, v ...interface{}) { - logger.Errorfln(format, v...) -} - +// Criticalfln prints the logging content with [CRIT] header, newline and custom format. +// It also prints caller backtrace info if backtrace feature is enabled. func Criticalfln(format string, v ...interface{}) { logger.Criticalfln(format, v...) } diff --git a/g/os/glog/glog_logger_api.go b/g/os/glog/glog_logger_api.go index 92b880a94..08327bc78 100644 --- a/g/os/glog/glog_logger_api.go +++ b/g/os/glog/glog_logger_api.go @@ -28,7 +28,7 @@ func (l *Logger) Println(v ...interface{}) { l.Print(v...) } -// Printf prints with newline and format using fmt.Sprintf. +// Printfln prints with newline and format using fmt.Sprintf. // The param can be multiple variables. func (l *Logger) Printfln(format string, v ...interface{}) { l.printStd(fmt.Sprintf(format + ln, v...))