service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceError = TypeError{Code: 2, Description: "Сервисная ошибка"}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	System        string // Название сервиса
	Development   bool   // Режим разработки
	Directory     string // Папка в которую необходимо сохранять логи
	LogFileName   string // Файл логов
	PanicFileName string // Файл ошибок с паникой
	Webhook       string // Url для отправки вебхука
}

type LogErrorStruct

type LogErrorStruct struct {
	System  string    `json:"system"`
	Message string    `json:"message"`
	Error   TypeError `json:"error"`
}

type LogStruct

type LogStruct struct {
	Message string
	Color   color.Attribute
}

type LoggerService

type LoggerService struct {
	Log         *log.Logger
	ServiceName string
	WebhookUrl  string
	Development bool
}

func (*LoggerService) Debug

func (s *LoggerService) Debug(ls LogStruct)

Лог дебага

func (*LoggerService) Debugf

func (s *LoggerService) Debugf(f string, v ...interface{})

func (*LoggerService) Error

func (s *LoggerService) Error(message LogErrorStruct)

Ошибка

func (*LoggerService) Errorf

func (s *LoggerService) Errorf(f string, v ...interface{})

func (*LoggerService) Infof

func (s *LoggerService) Infof(f string, v ...interface{})

func (*LoggerService) Notify

func (s *LoggerService) Notify(message string)

Простое оповещение в телеграм без вывода в консоль

func (*LoggerService) Print

func (s *LoggerService) Print(ls LogStruct)

Простой вывод текста

func (*LoggerService) RouteSeparator

func (s *LoggerService) RouteSeparator(route string)

func (*LoggerService) Separator

func (s *LoggerService) Separator()

func (*LoggerService) TraceHandler

func (s *LoggerService) TraceHandler(c *fiber.Ctx, e interface{})

Трейс ошибки для рекавера

func (*LoggerService) Warningf

func (s *LoggerService) Warningf(f string, v ...interface{})

type TypeError

type TypeError struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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