Back to

Package flg

Latest Go to latest

The latest major version is .

Published: Dec 28, 2019 | License: Apache-2.0 | Module:



const (
	//logmod 默认是 1 文件  2 stdout 4 其他
	FILE_MODE = 1 << iota

	TIME_KEY        = "time"
	LEVEL_KEY       = "level"
	NAME_KEY        = "logger"
	CALLER_KEY      = "line"
	MESSAGE_KEY     = "data"
	STACK_TRACE_KEY = "stacktrace"
	SERVER_NAME     = "server"
const (
	TIMEFORMAT = "2006-01-02 15-04-05.000"

type FConfig

type FConfig struct {
	Lfg LConfig `toml:"jackcfg"`

	Zfgs map[string]ZConfig `toml:"zapcfgs"`

type LConfig

type LConfig struct {
	Filename   string `toml:"filename"`
	MaxSize    int    `toml:"maxsize"` //MB
	MaxAge     int    `toml:"maxage"`
	MaxBackups int    `toml:"maxbackups"`
	LocalTime  bool   `toml:"localtime"`
	Compress   bool   `toml:"compress"`

type Logger

type Logger struct {
	// contains filtered or unexported fields


func (*Logger) GetLogByKey

func (l *Logger) GetLogByKey(key string) (*zap.Logger, error)

func (*Logger) LoadFromFile

func (l *Logger) LoadFromFile(filename string) error

* 从文件加载日志配置

func (*Logger) LoadFromObject

func (l *Logger) LoadFromObject(fconfig *FConfig) error

type ZConfig

type ZConfig struct {
	LogName       string `toml:"logname"`
	Timekey       string `toml:"timekey"`
	LevelKey      string `toml:"levelkey"`
	NameKey       string `toml:"namekey"`
	CallerKey     string `toml:"callerkey"`
	MessageKey    string `toml:"messagekey"`
	StacktraceKey string `toml:"stacktracekey"`

	Level      string `toml:"level"`
	IsDev      bool   `toml:"isdev"`
	LogMod     int8   `toml:"logmod"`
	ServerName string `toml:"servername"`

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier