Merge master and develop
This commit is contained in:
@@ -4,7 +4,7 @@ logs is a Go logs manager. It can use many logs adapters. The repo is inspired b
|
||||
|
||||
## How to install?
|
||||
|
||||
go get github.com/beego/beego/v2/logs
|
||||
go get github.com/beego/beego/v2/core/logs
|
||||
|
||||
## What adapters are supported?
|
||||
|
||||
@@ -16,7 +16,7 @@ First you must import it
|
||||
|
||||
```golang
|
||||
import (
|
||||
"github.com/beego/beego/v2/logs"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ func NewES() logs.Logger {
|
||||
// please import this package
|
||||
// usually means that you can import this package in your main package
|
||||
// for example, anonymous:
|
||||
// import _ "github.com/beego/beego/v2/logs/es"
|
||||
// import _ "github.com/beego/beego/v2/core/logs/es"
|
||||
type esLogger struct {
|
||||
*elasticsearch.Client
|
||||
DSN string `json:"dsn"`
|
||||
|
||||
@@ -33,6 +33,11 @@ import (
|
||||
// Writes messages by lines limit, file size limit, or time frequency.
|
||||
type fileLogWriter struct {
|
||||
sync.RWMutex // write log order by order and atomic incr maxLinesCurLines and maxSizeCurSize
|
||||
|
||||
Rotate bool `json:"rotate"`
|
||||
Daily bool `json:"daily"`
|
||||
Hourly bool `json:"hourly"`
|
||||
|
||||
// The opened file
|
||||
Filename string `json:"filename"`
|
||||
fileWriter *os.File
|
||||
@@ -49,19 +54,15 @@ type fileLogWriter struct {
|
||||
maxSizeCurSize int
|
||||
|
||||
// Rotate daily
|
||||
Daily bool `json:"daily"`
|
||||
MaxDays int64 `json:"maxdays"`
|
||||
dailyOpenDate int
|
||||
dailyOpenTime time.Time
|
||||
|
||||
// Rotate hourly
|
||||
Hourly bool `json:"hourly"`
|
||||
MaxHours int64 `json:"maxhours"`
|
||||
hourlyOpenDate int
|
||||
hourlyOpenTime time.Time
|
||||
|
||||
Rotate bool `json:"rotate"`
|
||||
|
||||
Level int `json:"level"`
|
||||
|
||||
Perm string `json:"perm"`
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// Package logs provide a general log interface
|
||||
// Usage:
|
||||
//
|
||||
// import "github.com/beego/beego/v2/logs"
|
||||
// import "github.com/beego/beego/v2/core/logs"
|
||||
//
|
||||
// log := NewLogger(10000)
|
||||
// log.SetLogger("console", "")
|
||||
@@ -112,17 +112,17 @@ func Register(name string, log newLoggerFunc) {
|
||||
// Can contain several providers and log message into all providers.
|
||||
type BeeLogger struct {
|
||||
lock sync.Mutex
|
||||
level int
|
||||
init bool
|
||||
enableFuncCallDepth bool
|
||||
loggerFuncCallDepth int
|
||||
enableFullFilePath bool
|
||||
asynchronous bool
|
||||
wg sync.WaitGroup
|
||||
level int
|
||||
loggerFuncCallDepth int
|
||||
prefix string
|
||||
msgChanLen int64
|
||||
msgChan chan *LogMsg
|
||||
signalChan chan string
|
||||
wg sync.WaitGroup
|
||||
outputs []*nameLogger
|
||||
globalFormatter string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user