ring

package module
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxMemoryCache — лимит кеша логов в памяти по умолчанию (20 Мб)
	DefaultMaxMemoryCache int64 = 20 << 20
	// DefaultMaxFileCache — лимит файлового кеша логов по умолчанию (50 Мб)
	DefaultMaxFileCache int64 = 50 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStats added in v0.1.13

type CacheStats struct {
	MemEntries int
	MemBytes   int64
	FileBytes  int64
}

CacheStats — состояние кеша логов.

type Client

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

func NewClient added in v0.1.6

func NewClient(address string, config *tls.Config, opts ...Option) *Client

func (*Client) CacheStats added in v0.1.13

func (c *Client) CacheStats() CacheStats

CacheStats возвращает текущее состояние кеша неотправленных логов.

func (*Client) Send

func (c *Client) Send(data []byte) error

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop()

type Hook added in v0.1.6

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

func NewHook added in v0.1.6

func NewHook(params Params) (*Hook, error)

NewHook Инициализация logrus hook

func (*Hook) Close added in v0.1.6

func (h *Hook) Close()

func (*Hook) Fire added in v0.1.6

func (h *Hook) Fire(entry *logrus.Entry) error

func (*Hook) Levels added in v0.1.6

func (h *Hook) Levels() []logrus.Level

type LogEntry added in v0.1.6

type LogEntry struct {
	Timestamp string                 `json:"timestamp"`
	Level     string                 `json:"level"`
	Message   string                 `json:"message"`
	Hostname  string                 `json:"hostname"`
	AppName   string                 `json:"app_name"`
	Token     string                 `json:"token"`
	File      string                 `json:"file"`
	Fields    map[string]interface{} `json:"fields,omitempty"`
}

type Option added in v0.1.13

type Option func(*clientOptions)

Option настраивает параметры клиента.

func WithCacheDir added in v0.1.13

func WithCacheDir(dir string) Option

WithCacheDir задаёт директорию для файлового кеша логов (по умолчанию os.TempDir()/ring-log-cache).

func WithMaxFileCache added in v0.1.13

func WithMaxFileCache(bytes int64) Option

WithMaxFileCache задаёт лимит файлового кеша логов в байтах (по умолчанию 50 Мб).

func WithMaxMemoryCache added in v0.1.13

func WithMaxMemoryCache(bytes int64) Option

WithMaxMemoryCache задаёт лимит кеша логов в памяти в байтах (по умолчанию 20 Мб).

type Params added in v0.1.6

type Params struct {
	Address   string
	Token     string
	AppName   string
	IgnoreDir string
	// CacheDir — директория файлового кеша логов на случай отсутствия
	// связи с сервером (по умолчанию os.TempDir()/ring-log-cache)
	CacheDir string
	// MaxMemoryCache — лимит кеша логов в памяти в байтах (по умолчанию 20 Мб)
	MaxMemoryCache int64
	// MaxFileCache — лимит файлового кеша логов в байтах (по умолчанию 50 Мб)
	MaxFileCache int64
}

func (Params) String added in v0.1.12

func (p Params) String() string

Jump to

Keyboard shortcuts

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