logging

package
v3.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPruningSize = 1024 * 1024 * 200
	NoPruning          = -1
)
View Source
const (
	// DefaultMaxLogFileSize defines the maximum log size we should permit: 5 MB
	//
	// The Zendesk limit for an attachment is 50MB and this is what will
	// be allowed via the API. However, if that fails for some reason, the
	// fallback is sending the report via email, which has a limit of 10mb
	// total or 7MB per file.
	DefaultMaxLogFileSize = 5 * 1024 * 1024
)

Variables

This section is empty.

Functions

func Close added in v3.4.0

func Close(closer io.Closer) error

Close closes the log file. if closer is nil, no error is reported.

func DumpStackTrace

func DumpStackTrace(logsPath string, sessionID SessionID, appName AppName) crash.RecoveryAction

func Init

func Init(logsPath string, sessionID SessionID, appName AppName, rotationSize, pruningSize int64, level string) (io.Closer, error)

Init Initialize logging. Log files are rotated when their size exceeds rotationSize. if pruningSize >= 0, pruning occurs using the default pruning algorithm.

func MatchBridgeLogName added in v3.4.0

func MatchBridgeLogName(filename string) bool

MatchBridgeLogName return true iff filename is a bridge log filename.

func MatchGUILogName

func MatchGUILogName(filename string) bool

MatchGUILogName return true iff filename is a bridge-gui log filename.

func MatchLauncherLogName added in v3.4.0

func MatchLauncherLogName(filename string) bool

MatchLauncherLogName return true iff filename is a launcher log filename.

func MatchStackTraceName

func MatchStackTraceName(name string) bool

func Sensitive

func Sensitive(s string) string

func WithLogrusField

func WithLogrusField(ctx context.Context, key string, value interface{}) context.Context

func ZipLogsForBugReport added in v3.4.0

func ZipLogsForBugReport(logsPath string, maxSessionCount int, maxZipSize int64) (*bytes.Buffer, error)

ZipLogsForBugReport returns an archive containing the logs for bug report.

Types

type AppName added in v3.4.0

type AppName string
const (
	BridgeShortAppName   AppName = "bri"
	LauncherShortAppName AppName = "lau"
	GUIShortAppName      AppName = "gui"
)

type FileProvider

type FileProvider func(index int) (io.WriteCloser, error)

type IMAPLogger

type IMAPLogger struct{}

IMAPLogger implements the writer interface for Gluon IMAP logs.

func NewIMAPLogger

func NewIMAPLogger() *IMAPLogger

func (*IMAPLogger) Write

func (l *IMAPLogger) Write(p []byte) (n int, err error)

type Pruner added in v3.4.0

type Pruner func() (failureCount int, err error)

type Rotator

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

func NewDefaultRotator added in v3.4.0

func NewDefaultRotator(logsPath string, sessionID SessionID, appName AppName, maxLogFileSize, pruningSize int64) (*Rotator, error)

func NewRotator

func NewRotator(maxFileSize int64, getFile FileProvider, prune Pruner) (*Rotator, error)

func (*Rotator) Close added in v3.4.0

func (r *Rotator) Close() error

func (*Rotator) Write

func (r *Rotator) Write(p []byte) (int, error)

type SMTPDebugLogger

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

SMTPDebugLogger implements the writer interface for debug SMTP logs.

func NewSMTPDebugLogger

func NewSMTPDebugLogger() *SMTPDebugLogger

func (*SMTPDebugLogger) Write

func (l *SMTPDebugLogger) Write(p []byte) (n int, err error)

type SMTPErrorLogger

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

SMTPErrorLogger implements go-smtp/logger interface.

func NewSMTPLogger

func NewSMTPLogger() *SMTPErrorLogger

func (*SMTPErrorLogger) Printf

func (s *SMTPErrorLogger) Printf(format string, args ...interface{})

func (*SMTPErrorLogger) Println

func (s *SMTPErrorLogger) Println(args ...interface{})

type SessionID added in v3.4.0

type SessionID string

func NewSessionID added in v3.4.0

func NewSessionID() SessionID

NewSessionID creates a sessionID based on the current time.

func NewSessionIDFromString added in v3.4.0

func NewSessionIDFromString(str string) SessionID

NewSessionIDFromString Return a new sessionID from string. If the str is empty a new time based sessionID is returned, otherwise the string is used as the sessionID.

Jump to

Keyboard shortcuts

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