|
@@ -64,6 +64,26 @@ func Close() error {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Debug writes v into access log.
|
|
|
|
+func Debug(v ...interface{}) {
|
|
|
|
+ writeDebug(fmt.Sprint(v...))
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Debugf writes v with format into access log.
|
|
|
|
+func Debugf(format string, v ...interface{}) {
|
|
|
|
+ writeDebug(fmt.Sprintf(format, v...))
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Debugv writes v into access log with json content.
|
|
|
|
+func Debugv(v interface{}) {
|
|
|
|
+ writeDebug(v)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Debugw writes msg along with fields into access log.
|
|
|
|
+func Debugw(msg string, fields ...LogField) {
|
|
|
|
+ writeDebug(msg, fields...)
|
|
|
|
+}
|
|
|
|
+
|
|
// Disable disables the logging.
|
|
// Disable disables the logging.
|
|
func Disable() {
|
|
func Disable() {
|
|
atomic.StoreUint32(&disableLog, 1)
|
|
atomic.StoreUint32(&disableLog, 1)
|
|
@@ -352,6 +372,8 @@ func handleOptions(opts []LogOption) {
|
|
|
|
|
|
func setupLogLevel(c LogConf) {
|
|
func setupLogLevel(c LogConf) {
|
|
switch c.Level {
|
|
switch c.Level {
|
|
|
|
+ case levelDebug:
|
|
|
|
+ SetLevel(DebugLevel)
|
|
case levelInfo:
|
|
case levelInfo:
|
|
SetLevel(InfoLevel)
|
|
SetLevel(InfoLevel)
|
|
case levelError:
|
|
case levelError:
|
|
@@ -392,6 +414,12 @@ func shallLogStat() bool {
|
|
return atomic.LoadUint32(&disableStat) == 0
|
|
return atomic.LoadUint32(&disableStat) == 0
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func writeDebug(val interface{}, fields ...LogField) {
|
|
|
|
+ if shallLog(DebugLevel) {
|
|
|
|
+ getWriter().Debug(val, addCaller(fields...)...)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
func writeError(val interface{}, fields ...LogField) {
|
|
func writeError(val interface{}, fields ...LogField) {
|
|
if shallLog(ErrorLevel) {
|
|
if shallLog(ErrorLevel) {
|
|
getWriter().Error(val, addCaller(fields...)...)
|
|
getWriter().Error(val, addCaller(fields...)...)
|