log

package
v0.0.0-...-3f388d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

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

View Source
const (
	LevelDebug = "DEBUG"
	LevelInfo  = "INFO"
	LevelWarn  = "WARN"
	LevelError = "ERROR"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...Field)

func Error

func Error(msg string, fields ...Field)

func Info

func Info(msg string, fields ...Field)

func Init

func Init()

func Sync

func Sync()

func Warn

func Warn(msg string, fields ...Field)

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

type Field = zap.Field

func Binary

func Binary(key string, val []byte) Field

func Bool

func Bool(key string, val bool) Field

func ByteString

func ByteString(key string, val []byte) Field

func Float64

func Float64(key string, val float64) Field

func Int

func Int(key string, val int) Field

func Int16

func Int16(key string, val int16) Field

func Int32

func Int32(key string, val int32) Field

func Int64

func Int64(key string, val int64) Field

func Int8

func Int8(key string, val int8) Field

func String

func String(key string, val string) Field

func Uint

func Uint(key string, val uint) Field

func Uint16

func Uint16(key string, val uint16) Field

func Uint32

func Uint32(key string, val uint32) Field

func Uint64

func Uint64(key string, val uint64) Field

func Uint8

func Uint8(key string, val uint8) Field

type LogErrorMessage

type LogErrorMessage struct {
	ErrorCode int    `json:"errorCode"`
	ErrorMsg  string `json:"errorMsg"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL