LogrusULog

package module
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 12 Imported by: 5

README

Logrus

support both linux mac andwindows
install
go get "github.com/universe-30/logrusULog"
example
package main
 
import (
	LogrusULog "github.com/universe-30/LogrusULog"
	"github.com/universe-30/ULog"
)

func main() {
	//default is info level
	ulog, err := LogrusULog.New("./logs", 1, 20, 30)
	if err != nil {
		panic(err.Error())
	}

	ulog.SetLevel(ULog.TraceLevel)

	ulog.Traceln("trace log")
	ulog.Debugln("debug log")
	ulog.Infoln("info log")
	ulog.Warnln("warn log")
	ulog.Errorln("error log")
	//ulog.Fatalln("fatal log")
	//ulog.Panicln("panic log")

	ulog.PrintLastN(100, []ULog.LogLevel{ULog.ErrorLevel, ULog.InfoLevel})
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logsAbsFolder string, fileMaxSizeMBytes int, MaxBackupsFiles int, MaxAgeDays int) (ULog.Logger, error)

Default is info level

Types

type Fields

type Fields = logrus.Fields

type LocalLog

type LocalLog struct {
	*logrus.Logger
	ALL_LogfolderABS string
	ERR_LogfolderABS string
	MaxSize          int
	MaxBackups       int
	MaxAge           int
}

func (*LocalLog) GetLastN

func (logger *LocalLog) GetLastN(lineCount int, levels []LogLevel) ([]string, error)

func (*LocalLog) GetLevel added in v0.1.17

func (logger *LocalLog) GetLevel() ULog.LogLevel

func (*LocalLog) PrintLastN

func (logger *LocalLog) PrintLastN(lineCount int, levels []LogLevel)

func (*LocalLog) SetLevel

func (logger *LocalLog) SetLevel(loglevel LogLevel)

type LogLevel

type LogLevel = ULog.LogLevel

type UTCFormatter

type UTCFormatter struct {
	logrus.Formatter
}

func (UTCFormatter) Format

func (u UTCFormatter) Format(e *logrus.Entry) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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