log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLevel 默认日志级别
	DefaultLevel = zapcore.DebugLevel
	// DefaultFileName 默认日志输出路径
	DefaultFilename = "./july-log.log"
	// DefaultMaxSize 默认单日志文件大小
	DefaultMaxSize = 100
)

默认值

Variables

View Source
var Logworker *zap.SugaredLogger

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func Compress

func Compress(compress bool) Option

Compress 是否压缩日志文件

func Filename

func Filename(filename string) Option

Filename 日志文件名

func Level

func Level(l string) Option

Level 日志级别

func LocalTime

func LocalTime(localTime bool) Option

LocalTime 是否使用本地时间

func Logger

func Logger(logger *zap.SugaredLogger) Option

Logger 设置日志对象

func MaxBackups

func MaxBackups(a int) Option

最大备份数量

func MaxSize

func MaxSize(maxSize int32) Option

MaxSize 单日志文件大小上限

type Options

type Options struct {
	Logger     *zap.SugaredLogger
	Filename   string
	MaxSize    int32
	LocalTime  bool
	Compress   bool
	MaxBackups int
	Level      zapcore.Level
}

type ZapLogger

type ZapLogger struct {
	Options       *Options
	SugaredLogger *zap.SugaredLogger
}

func NewZapLogger

func NewZapLogger(opts ...Option) *ZapLogger

func (*ZapLogger) StreamClient

func (zap *ZapLogger) StreamClient(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (cs grpc.ClientStream, err error)

use ZapLogger to implement middleware

Jump to

Keyboard shortcuts

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