logger

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 7 Imported by: 28

README

logger

How to use

The duration for recording a single log file is 24 hours. After the duration exceeds 24 hours, a log file is automatically divided. All logs can be stored for a maximum of 7 x 24 hours.

Def use

Logs are stored in the Log folder under the current program. The default log level is Info.

logger.SetLoggerName("AppName")
logger.Info("haha")
Change log level
logger.SetLoggerName("AppName")
logger.Info("haha")

logger.SetLoggerLevel(logrus.InfoLevel)
logger.Debug("haha")
Set log file save path

By default, will save at ./Logs/

logger.SetLoggerRootDir("/config/xxx")
// will save at /config/xxx/Config
Set logger name

By default, will save log files like: logger.log

logger.SetLoggerName("AppName")
// will save like AppName.log

Base on

Documentation

Index

Constants

View Source
const (
	NameDef = "logger"
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Debugln

func Debugln(args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Errorln

func Errorln(args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Fatalln

func Fatalln(args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func Infoln

func Infoln(args ...interface{})

func NewLogHelper

func NewLogHelper(appName string, level logrus.Level, maxAge time.Duration, rotationTime time.Duration) *logrus.Logger

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func Panicln

func Panicln(args ...interface{})

func Print

func Print(args ...interface{})

func Printf

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

func Println

func Println(args ...interface{})

func SetLoggerLevel

func SetLoggerLevel(level logrus.Level)

func SetLoggerName

func SetLoggerName(logName string)

func SetLoggerRootDir

func SetLoggerRootDir(loggerRootDir string)

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

func Warning

func Warning(args ...interface{})

func Warningf

func Warningf(format string, args ...interface{})

func Warningln

func Warningln(args ...interface{})

func Warnln

func Warnln(args ...interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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