mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
[feature] improve code glog
This commit is contained in:
@ -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.
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -8,6 +8,7 @@ package glog_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user