Optimize maligned structs

This commit is contained in:
Nitin Mohan
2021-03-08 12:44:14 +05:30
parent 7909fb5ff3
commit f554a1c543
12 changed files with 91 additions and 88 deletions

View File

@@ -51,24 +51,25 @@ func TestTagAutoWireBeanFactory_AutoWire(t *testing.T) {
}
type ComplicateStruct struct {
IntValue int `default:"12"`
StrValue string `default:"hello, strValue"`
Int8Value int8 `default:"8"`
Int16Value int16 `default:"16"`
Int32Value int32 `default:"32"`
Int64Value int64 `default:"64"`
BoolValue bool `default:"true"`
Int8Value int8 `default:"8"`
Uint8Value uint8 `default:"88"`
UintValue uint `default:"13"`
Uint8Value uint8 `default:"88"`
Int16Value int16 `default:"16"`
Uint16Value uint16 `default:"1616"`
Int32Value int32 `default:"32"`
Uint32Value uint32 `default:"3232"`
IntValue int `default:"12"`
UintValue uint `default:"13"`
Int64Value int64 `default:"64"`
Uint64Value uint64 `default:"6464"`
StrValue string `default:"hello, strValue"`
Float32Value float32 `default:"32.32"`
Float64Value float64 `default:"64.64"`
BoolValue bool `default:"true"`
ignoreInt int `default:"11"`
TimeValue time.Time `default:"2018-02-03 12:13:14.000"`

View File

@@ -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"`

View File

@@ -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
}