logger

package
v0.0.0-...-6618439 Latest Latest
Warning

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

Go to latest
Published: May 25, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevelName   = "debug"
	InfoLevelName    = "info"
	WarningLevelName = "warning"
	ErrorLevelName   = "error"
)

название уровней логирования

Variables

This section is empty.

Functions

func Inst

func Inst() common.SendingService

создает новый сервис логирования

Types

type Config

type Config struct {
	// название уровня логирования, устанавливается в конфиге
	LevelName string `yaml:"logLevel"`

	// название вывода логов
	Output string `yaml:"logOutput"`
}

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

автор логов пишущий в файл

type Level

type Level int

уровень логирования

const (
	DebugLevel Level = iota
	InfoLevel
	WarningLevel
	ErrorLevel
)

уровни логирования

type Message

type Message struct {
	Hostname string
	// сообщение для лога, может содержать параметры
	Message string

	// уровень логирования записи, необходим для отсечения лишних записей
	Level Level

	// аргументы для параметров сообщения
	Args []interface{}

	Stack []byte
}

запись логирования

func All

func All() *Message

func By

func By(hostname string) *Message

func NewMessage

func NewMessage(level Level, message string, args ...interface{}) *Message

созадние новой записи логирования

func (*Message) Debug

func (m *Message) Debug(message string, args ...interface{})

пишет сообщение для отладки

func (*Message) Err

func (m *Message) Err(message string, args ...interface{})

пишет ошибку в лог

func (*Message) FailExit

func (m *Message) FailExit(message string, args ...interface{})

пишет произвольную ошибку в лог и завершает программу

func (*Message) FailExitWithErr

func (m *Message) FailExitWithErr(err error)

пишет системную ошибку в лог и завершает программу

func (*Message) Info

func (m *Message) Info(message string, args ...interface{})

пишет информационное сообщение

func (*Message) Warn

func (m *Message) Warn(message string, args ...interface{})

пишет произвольное предупреждение

func (*Message) WarnWithErr

func (m *Message) WarnWithErr(err error)

пишет системное предупреждение

type Service

type Service struct {
	Config

	Configs map[string]*Config `yaml:"postmans"`
}

сервис логирования

func (*Service) Events

func (s *Service) Events() chan *common.SendEvent

не учавствеут в отправке писем

func (*Service) OnFinish

func (s *Service) OnFinish()

закрывает канал логирования

func (*Service) OnInit

func (s *Service) OnInit(event *common.ApplicationEvent)

инициализирует сервис логирования

func (*Service) OnRun

func (s *Service) OnRun()

ничего не делает, авторы логов уже пишут

type StdoutWriter

type StdoutWriter struct {
	// contains filtered or unexported fields
}

автор логов пишущий в стандартный вывод

type Writer

type Writer interface {
	// contains filtered or unexported methods
}

автор логов

Jump to

Keyboard shortcuts

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