service

package
v0.0.0-...-0575462 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogEntry

type DefaultLogEntry struct {
	Labels   Labels `json:"labels" structs:"logging.googleapis.com/labels"`
	Severity string `json:"severity" structs:"logging.googleapis.com/severity"`
}

type GinService

type GinService struct {
	Engine *gin.Engine
}

func ProvideGinService

func ProvideGinService() *GinService

type HTTPRequestLogEntry

type HTTPRequestLogEntry struct {
	HttpRequest HttpRequest `json:"http_request" structs:"logging.googleapis.com/httpRequest"`
	Labels      Labels      `json:"labels" structs:"logging.googleapis.com/labels"`
	Severity    string      `json:"severity" structs:"logging.googleapis.com/severity"`
	RequestBody any         `json:"request_body" structs:"requestBody"`
}

type HTTPResponseLogEntry

type HTTPResponseLogEntry struct {
	HttpRequest  HttpRequest `json:"http_request" structs:"logging.googleapis.com/httpRequest"`
	Labels       Labels      `json:"labels" structs:"logging.googleapis.com/labels"`
	Severity     string      `json:"severity" structs:"logging.googleapis.com/severity"`
	UserID       int64       `json:"user_id" structs:"userId"`
	ResponseBody any         `json:"response_body" structs:"responseBody"`
}

type HttpRequest

type HttpRequest struct {
	RequestMethod string `json:"request_method" structs:"requestMethod"`
	RequestURL    string `json:"request_url" structs:"requestUrl"`
	Status        int    `json:"status" structs:"status"`
	UserAgent     string `json:"user_agent" structs:"userAgent"`
	RemoteIP      string `json:"remote_ip" structs:"remoteIp"`
	Latency       string `json:"latency" structs:"latency"`
	Protocol      string `json:"protocol" structs:"protocol"`
}

type Labels

type Labels struct {
	RequestID string `json:"request_id" structs:"request_id"`
	Source    string `json:"source" structs:"source"`
}

type LoggerService

type LoggerService struct {
	Log      *logrus.Logger
	Path     string
	FileName string
	IsTest   bool
}

func ProvideLogger

func ProvideLogger() (*LoggerService, error)

func (*LoggerService) CombineErrorMessage

func (l *LoggerService) CombineErrorMessage(format string, args ...interface{}) string

func (*LoggerService) GetLogEntrySeverity

func (l *LoggerService) GetLogEntrySeverity(level int) string

func (*LoggerService) GetLoggerFields

func (l *LoggerService) GetLoggerFields(logEntry any) logrus.Fields

func (*LoggerService) LogFile

func (l *LoggerService) LogFile(ctx context.Context, level logrus.Level, logEntry any, message string)

type PostgresService

type PostgresService struct {
	DB *gorm.DB
}

func ProvidePostgreService

func ProvidePostgreService() (*PostgresService, error)

type Service

type Service struct {
	GinService      *GinService
	PostgresService *PostgresService
	LoggerService   *LoggerService
}

func InitService

func InitService() (*Service, error)

func ProvideService

func ProvideService(g *GinService, p *PostgresService, l *LoggerService) *Service

Jump to

Keyboard shortcuts

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