logger

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSimpleLokiConfig

func GetSimpleLokiConfig(lokiUrl string) (*loki.Config, error)

Types

type LogData

type LogData struct {
	AppName string
	Log     *log.Logger
	File    *string
	Hook    log.Hook
}

LogData:

  • File: (optional) default redirect all log to stdout.
  • Hook: (optional) Provide log hook to trasfer logs.
var Logger *LogData = nil

func (*LogData) Error

func (l *LogData) Error(message string)

Error logs an error message with the application name.

func (*LogData) Info

func (l *LogData) Info(message string)

Info logs an info message with the application name.

func (*LogData) InitLogger

func (l *LogData) InitLogger() error

func (*LogData) Warn

func (l *LogData) Warn(message string)

Warn logs a warning message with the application name.

type LokiHook

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

func NewLokiHook

func NewLokiHook(lokiConfig *loki.Config) (*LokiHook, error)

func (*LokiHook) Fire

func (hook *LokiHook) Fire(entry *log.Entry) error

func (*LokiHook) Levels

func (hook *LokiHook) Levels() []log.Level

Jump to

Keyboard shortcuts

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