log

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

log包实现了基于logrus的日志管理器

Index

Constants

View Source
const (
	DefaultLogPath   = "/wwwlogs/"
	SystemLogPrefix  = "system_"
	RequestLogPrefix = "request_"
	AppLogPrefix     = "app_"
	MqLogPrefix      = "mq_"
	LogSuffix        = ".log"

	AppLogComponentName    = "app"
	TraceLogComponentName  = "trace"
	MqLogComponentName     = "mq"
	SystemLogComponentName = "phplogs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context map[string]interface{}

type Logger

type Logger interface {
	Info(message string, context Context)
	Debug(message string, context Context)
	Warn(message string, context Context)
	Error(message string, context Context)
	Fatal(message string, context Context)
	SetExtends(extends Context)
}

Logger 日志接口

func New

func New() Logger

New 获取默认的日志管理器,输出到控制台

func NewFileLogger

func NewFileLogger(filePath string) Logger

NewFileLogger 根据文件初始化日志

type Manager

type Manager interface {
	App() Logger
	Request() Logger
	System() Logger
	Mq() Logger
	// contains filtered or unexported methods
}

Manager 接口

func NewManager

func NewManager(conf ManagerConf) Manager

InitManager 初始化管理器

type ManagerConf

type ManagerConf struct {
	SystemName string
	SystemPort int
	LogPath    string
}

ManagerConf 日志配置

Jump to

Keyboard shortcuts

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