[feature] improve code glog

This commit is contained in:
houseme
2021-11-15 20:31:16 +08:00
parent b664982be3
commit cd60a4aca7
13 changed files with 35 additions and 25 deletions

View File

@ -10,25 +10,24 @@ import (
"bytes"
"context"
"fmt"
"github.com/fatih/color"
"github.com/gogf/gf/v2/container/gtype"
"github.com/gogf/gf/v2/internal/intlog"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gfpool"
"github.com/gogf/gf/v2/os/gmlock"
"github.com/gogf/gf/v2/os/gtimer"
"go.opentelemetry.io/otel/trace"
"io"
"os"
"strings"
"time"
"github.com/fatih/color"
"github.com/gogf/gf/v2/container/gtype"
"github.com/gogf/gf/v2/debug/gdebug"
"github.com/gogf/gf/v2/internal/intlog"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/gfpool"
"github.com/gogf/gf/v2/os/gmlock"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/os/gtimer"
"github.com/gogf/gf/v2/text/gregex"
"github.com/gogf/gf/v2/util/gconv"
"go.opentelemetry.io/otel/trace"
)
// Logger is the struct for logging management.

View File

@ -8,14 +8,14 @@ package glog
import (
"context"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/os/gctx"
"io"
"strings"
"time"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/internal/intlog"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/util/gconv"
"github.com/gogf/gf/v2/util/gutil"
@ -255,7 +255,7 @@ func (l *Logger) SetHandlers(handlers ...Handler) {
l.config.Handlers = handlers
}
//SetWriterColorEnable sets the file logging with color
// SetWriterColorEnable sets the file logging with color
func (l *Logger) SetWriterColorEnable(enabled bool) {
l.config.WriterColorEnable = enabled
}

View File

@ -7,9 +7,10 @@
package glog
import (
"strings"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"strings"
)
// Note that the LEVEL_PANI and LEVEL_FATA levels are not used for logging output,

View File

@ -9,6 +9,8 @@ package glog
import (
"context"
"fmt"
"time"
"github.com/gogf/gf/v2/container/garray"
"github.com/gogf/gf/v2/encoding/gcompress"
"github.com/gogf/gf/v2/internal/intlog"
@ -17,7 +19,6 @@ import (
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/os/gtimer"
"github.com/gogf/gf/v2/text/gregex"
"time"
)
const (

View File

@ -8,6 +8,7 @@ package glog_test
import (
"context"
"github.com/gogf/gf/v2/frame/g"
)

View File

@ -9,9 +9,10 @@ package glog
import (
"bytes"
"context"
"testing"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"testing"
)
var (

View File

@ -9,12 +9,13 @@ package glog
import (
"bytes"
"fmt"
"testing"
"time"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"testing"
"time"
)
func Test_To(t *testing.T) {

View File

@ -7,13 +7,14 @@
package glog_test
import (
"sync"
"testing"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"sync"
"testing"
)
func Test_Concurrent(t *testing.T) {

View File

@ -8,9 +8,10 @@ package glog
import (
"bytes"
"github.com/gogf/gf/v2/test/gtest"
"strings"
"testing"
"github.com/gogf/gf/v2/test/gtest"
)
func Test_SetConfigWithMap(t *testing.T) {

View File

@ -9,12 +9,13 @@ package glog_test
import (
"bytes"
"context"
"testing"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"testing"
)
func Test_Ctx(t *testing.T) {

View File

@ -9,11 +9,12 @@ package glog_test
import (
"bytes"
"context"
"testing"
"github.com/gogf/gf/v2/container/garray"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"testing"
)
var arrayForHandlerTest1 = garray.NewStrArray()

View File

@ -8,9 +8,10 @@ package glog
import (
"bytes"
"testing"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"testing"
)
func Test_LevelPrefix(t *testing.T) {

View File

@ -9,14 +9,15 @@ package glog_test
import (
"context"
"fmt"
"testing"
"time"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/text/gstr"
"testing"
"time"
)
var (