logtail

package module
v0.0.0-...-20ffe4a Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 12 Imported by: 0

README

slog-logtail

Usage Example:

	appInfoLogs := slog.Group(
		"app_info",
		slog.Int("pid", os.Getpid()),
		slog.String("env", appEnv),
	)

	loger := NewLoggerWithChild(LOGTAIL_SECRET, appInfoLogs)
	loger.SetDefault()

	//Telegream logger
	var tgLogger TgLogger = TgLoger{
		Token:  tgLoggerSecret,
		ChatID: TELEGRAM_CHAT_ID,
		Logger: &loger,
	}
	tgLogger.Log(logtail.INFO, "Starting...")

Documentation

Index

Constants

View Source
const (
	INFO  LogLevel = "INFO"
	WARN           = "WARN"
	ERR            = "ERR"
	DEBUG          = "DEBUG"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel string

type Logger

type Logger struct {
	*slog.Logger
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(logtailSecret string) Logger

func NewLoggerWithChild

func NewLoggerWithChild(logtailSecret string, args ...any) Logger

func (*Logger) Log

func (l *Logger) Log(logLevel LogLevel, msg string, args ...any) string

func (*Logger) SetDefault

func (l *Logger) SetDefault()

type Logtail

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

func NewLogtail

func NewLogtail(token string) *Logtail

func (*Logtail) Send

func (l *Logtail) Send(body string) (int, error)

type TelegramLogerObject

type TelegramLogerObject struct {
	Token  string
	ChatID int64
	Logger *Logger
}

func (TelegramLogerObject) Log

func (tlo TelegramLogerObject) Log(logLevel LogLevel, msgName string, body ...any)

type TelegramLogger

type TelegramLogger interface {
	Log(logLevel LogLevel, msgName string, body ...any)
}

func NewTelegramLoger

func NewTelegramLoger(token string, chatID int64, logger *Logger) TelegramLogger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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