config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileConfigDriver

func NewFileConfigDriver() dlog.ConfigDriver

Types

type Config

type Config struct {
	Dir    string
	File   string
	Expire int
	Period LogPeriod
	Level  log.Level
}

func ToConfig

func ToConfig(v interface{}) (*Config, error)

type ConfigEncode

type ConfigEncode struct {
	Dir    string `json:"dir"`
	File   string `json:"file"`
	Level  string `json:"level"`
	Period string `json:"period"`
	Expire int    `json:"expire"`
}

type FileConfigDriver

type FileConfigDriver struct {
	*dlog.FullFieldsDriver
}

func (*FileConfigDriver) Decode

func (c *FileConfigDriver) Decode(v string) (interface{}, error)

func (*FileConfigDriver) Encode

func (c *FileConfigDriver) Encode(v interface{}) (string, error)

func (*FileConfigDriver) Format

func (c *FileConfigDriver) Format(v string) (interface{}, error)

func (*FileConfigDriver) Name

func (c *FileConfigDriver) Name() string

func (*FileConfigDriver) Title

func (c *FileConfigDriver) Title() string

type LogPeriod

type LogPeriod interface {
	String() string
	FormatLayout() string
}

LogPeriod 日志周期

func ParsePeriod

func ParsePeriod(v string) (LogPeriod, error)

ParsePeriod 解析周期

type LogPeriodType

type LogPeriodType int

LogPeriodType 日志周期类型

const (
	//PeriodMonth 月
	PeriodMonth LogPeriodType = iota
	//PeriodDay 日
	PeriodDay
	//PeriodHour 时
	PeriodHour
)

func (LogPeriodType) FormatLayout

func (period LogPeriodType) FormatLayout() string

FormatLayout 格式化

func (LogPeriodType) String

func (period LogPeriodType) String() string

Jump to

Keyboard shortcuts

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