Documentation ¶
Overview ¶
-------------------------------------------------------------------------
* * data_logger.go * Data Logger * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/log/data_logger.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * logger.go * Logger wrapper * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * common/log/logger.go *-------------------------------------------------------------------------
Index ¶
- Constants
- func Debug(msg string, fields ...Field)
- func Error(msg string, fields ...Field)
- func Info(msg string, fields ...Field)
- func Init()
- func Sync()
- func Warn(msg string, fields ...Field)
- type Conf
- type DataLogger
- type Field
- func Binary(key string, val []byte) Field
- func Bool(key string, val bool) Field
- func ByteString(key string, val []byte) Field
- func Float64(key string, val float64) Field
- func Int(key string, val int) Field
- func Int16(key string, val int16) Field
- func Int32(key string, val int32) Field
- func Int64(key string, val int64) Field
- func Int8(key string, val int8) Field
- func String(key string, val string) Field
- func Uint(key string, val uint) Field
- func Uint16(key string, val uint16) Field
- func Uint32(key string, val uint32) Field
- func Uint64(key string, val uint64) Field
- func Uint8(key string, val uint8) Field
- type LogErrorMessage
Constants ¶
View Source
const ( LevelDebug = "DEBUG" LevelInfo = "INFO" LevelWarn = "WARN" LevelError = "ERROR" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conf ¶
type Conf struct { Scan bool `json:"scan,omitempty"` ScanPeriod int `json:"scan_period,omitempty"` Production bool `json:"production,omitempty"` Level string `json:"level,omitempty"` Filename string `json:"filename"` Compress bool `json:"compress"` // compress using gzip? MaxSizeMB int `json:"max_size_mb"` MaxBackups int `json:"max_backups"` MaxAgeDays int `json:"max_age_days"` }
type DataLogger ¶
type DataLogger struct {
// contains filtered or unexported fields
}
func NewDataLogger ¶
func NewDataLogger(suffix, conf string) *DataLogger
InitDataLogger init the data logger
func (*DataLogger) BufferedPrintData ¶
func (d *DataLogger) BufferedPrintData(data string)
func (*DataLogger) FlushData ¶
func (d *DataLogger) FlushData()
func (*DataLogger) PrintData ¶
func (d *DataLogger) PrintData(data string)
PrintData print the original data to file, with one data per line not thread safe
type Field ¶
func ByteString ¶
type LogErrorMessage ¶
Click to show internal directories.
Click to hide internal directories.