record

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFormat

func CheckFormat(tpl string) (matches [][]int, err error)

Проверка шаблона на корректность

func TruncateString

func TruncateString(src, layout string) (ret string)

Обрезание строки в соответствии с форматом

Types

type Record

type Record struct {
	Id            u.UUID    `fmt:"id"`                    // %{id}                      - ([16]byte ) Time GUID(UUID) for log message
	Pid           int       `fmt:"pid:d"`                 // %{pid}                     - (int      ) Process id
	AppName       string    `fmt:"application:s"`         // %{application}             - (string   ) Application name basename of os.Args[0]
	HostName      string    `fmt:"hostname:s"`            // %{hostname}                - (string   ) Server host name
	TodayAndNow   time.Time `fmt:"time:t"`                // %{time}                    - (time.Time) Time when log occurred
	Level         l.Level   `fmt:"level:d"`               // %{level}                   - (int8     ) Log level
	Message       string    `fmt:"message:s"`             // %{message}                 - (string   ) Message
	FileNameLong  string    `fmt:"longfile:s"`            // %{longfile}                - (string   ) Full file name and line number: /a/b/c/d.go
	FileNameShort string    `fmt:"shortfile:s"`           // %{shortfile}               - (string   ) Final file name element and line number: d.go
	FileLine      int       `fmt:"line:d"`                // %{line}                    - (int      ) Line number in file
	Package       string    `fmt:"package:s"`             // %{package}                 - (string   ) Full package path, eg. github.com/webdeskltd/log
	Module        string    `fmt:"module:s,shortpkg:s"`   // %{module} or %{shortpkg}   - (string   ) Module name base package path, eg. log
	Function      string    `fmt:"function:s,facility:s"` // %{function} or %{facility} - (string   ) Full function name, eg. PutUint32
	CallStack     string    `fmt:"callstack:s"`           // %{callstack}               - (string   ) Full call stack
	// contains filtered or unexported fields
}

Игноритуются слеюующие поля структуры - Не имеющие тега fmt:"" - Описанные как fmt:"" - Описанные как fmt:"-" Если формат поля структуры не описан, то подставляется формат %v

func NewRecord

func NewRecord() (this *Record)

func (*Record) Format

func (self *Record) Format(tpl string) (ret string, err error)

Forming a formatted log message based on Record

func (*Record) Prepare

func (self *Record) Prepare() *Record

Подготовка сообщения Выполняется подготовка сообщения перед форматированием и выводом На данном этапе из переданных ранее args формируется единое текстовое сообщение

func (*Record) Resolver

func (self *Record) Resolver(f RecordResolveFn) *Record

Assigning function name resolution

func (*Record) SetLevel

func (self *Record) SetLevel(level l.Level) *Record

Set log level

func (*Record) SetMessage

func (self *Record) SetMessage(args ...interface{}) *Record

Set message

type RecordResolveFn

type RecordResolveFn func(r *Record)

Функция разрешения имён записи

Jump to

Keyboard shortcuts

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