logger

package module
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 8 Imported by: 0

README

logger

支持zap、logrus、default(常规文件写入)三种日志写入模式,日志打印 满足日常项目开发需要

主要配置参数

type: zap、logrus、default path:日志路径 level:日志等级,trace, debug, info, warn, error, fatal stdout: file、default 其中file表示日志写入文件、default表示文件控制台展示 cap:文件写入日志条数

使用方式

func main(){
	log := NewLogger(
		WithType("logrus"),
		WithPath("temp/logs"),
		WithLevel("info"),
		WithStdout("default"),
		WithCap(10),
	)

	log.Info("xxxxxx")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(opts ...Option) *logbase.Helper

NewLogger

@Description: new logger
@param opts
@return *logbase.Helper

Types

type Option

type Option func(*options)

func WithCap

func WithCap(n uint) Option

func WithLevel

func WithLevel(s string) Option

func WithPath

func WithPath(s string) Option

func WithStdout

func WithStdout(s string) Option

func WithType

func WithType(s string) Option

Directories

Path Synopsis
Package log provides debug logging
Package log provides debug logging

Jump to

Keyboard shortcuts

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