log

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug function to print a pretty formatted log debug message

func Debugf

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

Debugf function to print a pretty formatted log debug message

func Debugln

func Debugln(args ...interface{})

Debugln function to print a pretty formatted log debug message

func Error

func Error(args ...interface{})

Error function to print a pretty formatted log error message

func Errorf

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

Errorf function to print a pretty formatted log error message

func Errorln

func Errorln(args ...interface{})

Errorln function to print a pretty formatted log error message

func Fatal

func Fatal(args ...interface{})

Fatal function to print a pretty formatted log fatal message

func Fatalf

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

Fatalf function to print a pretty formatted log fatal message

func Fatalln

func Fatalln(args ...interface{})

Fatalln function to print a pretty formatted log fatal message

func Info

func Info(args ...interface{})

Info function to print a pretty formatted log info message

func Infof

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

Infof function to print a pretty formatted log info message

func Infoln

func Infoln(args ...interface{})

Infoln function to print a pretty formatted log info message

func Setup

func Setup(opts ...Option) error

Setup returns a new logrus instance

func Warn

func Warn(args ...interface{})

Warn function to print a pretty formatted log warn message

func Warnf

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

Warnf function to print a pretty formatted log warn message

func Warnln

func Warnln(args ...interface{})

Warnln function to print a pretty formatted log warn message

Types

type Config

type Config struct {
	Level   string
	Format  string
	Output  string
	File    string
	Verbose bool
}

Config defines all the configurable options for the logrus logger

func (*Config) SetDefault

func (config *Config) SetDefault(level, formater, output, file string, verbose bool)

SetDefault set default values for logrus logger configurable options

type Option

type Option func(*options) error

Option will configure a new logrus Logger

func WithConfig

func WithConfig(cfg Config) Option

WithConfig takes the logger configuration and applies it

func WithFormatter

func WithFormatter(format string) Option

WithFormatter allows setting the format to `text`, `color`, `json`, `json-pretty` or `plain`. In case the input is not recognized it defaults to text with a warning. More details of these formats: * `text` - human readable. * `color` - human readable, in color. Useful for development. * `json` - computer readable, new-line delimited JSON. * `json-pretty` - computer readable pretty JSON. * `plain` - custom human readable.

func WithLogLevel

func WithLogLevel(level string, verbose bool) Option

WithLogLevel is used to set the log level when defaulting to `info` is not wanted. Other options are: `debug`, `info`, `warn` and `error`

func WithOutput

func WithOutput(writer io.Writer) Option

WithOutput configures the writer used to write logs to

func WithOutputStr

func WithOutputStr(output, file string) Option

WithOutputStr allows customization of the sink of the logger. Output is either: `stdout`, `stderr`, or `file`

func WithSetReportCaller

func WithSetReportCaller(enable bool) Option

WithSetReportCaller configures the logrus logger SetReportCaller

Jump to

Keyboard shortcuts

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