logs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMode

type FileMode string

FileMode is used to unmarshal a unix file mode from the config file.

func (FileMode) Mode

func (f FileMode) Mode() os.FileMode

Mode returns the compatible os.FileMode.

func (FileMode) String

func (f FileMode) String() string

String creates a unix-octal version of a file mode.

type Level

type Level int

Level represents the log level.

const (
	LogLevelNormal Level = iota
	LogLevelDebug
	LogLevelTrace
)

Log Levels.

func (Level) String

func (l Level) String() string

String returns the human-readable log level.

type LogConfig

type LogConfig struct {
	Name  string
	Path  string
	Size  uint
	Mode  FileMode
	Level Level
	Files uint
	Lang  string
}

LogConfig allows sending logs to rotating files.

type Logger

type Logger struct {
	Wails logger.Logger // special interface for wails.

	File string
	// contains filtered or unexported fields
}

Logger provides some methods with baked in assumptions.

func New

func New() *Logger

New returns an uninitialized logger. Config is optional, but must be provided here or with Setup().

func (*Logger) CapturePanic

func (l *Logger) CapturePanic()

CapturePanic can be deferred in any go routine to log any panic that occurs.

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Debugf

func (l *Logger) Debugf(msg message.Reference, v ...any)

func (*Logger) Errorf

func (l *Logger) Errorf(msg message.Reference, v ...any)

func (*Logger) Infof added in v0.0.3

func (l *Logger) Infof(msg message.Reference, v ...any)

func (*Logger) Setup

func (l *Logger) Setup(ctx context.Context, config LogConfig)

SetupLogging splits log writers into a file and/or stdout. Config is optional, but must be provided here or with New().

func (*Logger) Tracef added in v0.0.3

func (l *Logger) Tracef(msg string, v ...any)

func (*Logger) Translate added in v0.0.3

func (l *Logger) Translate(msg message.Reference, v ...any) string

Translate is like Sprintf.

func (*Logger) Warnf added in v0.0.3

func (l *Logger) Warnf(msg message.Reference, v ...any)

Jump to

Keyboard shortcuts

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