logger

package
v0.0.0-...-14fd0b5 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package logger Created by RTT. Author: teocci@yandex.com on 2021-Aug-27

Package logger Created by Teocci. Author: teocci@yandex.com on 2021-Aug-23

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCanNotInitSyslog

func ErrCanNotInitSyslog(e error) error

func ErrCanNotOpenLogFile

func ErrCanNotOpenLogFile(p string, e error) error

func GetDefaultLevelName

func GetDefaultLevelName() string

func GetLevelName

func GetLevelName(level Level) string

func NewSyslog

func NewSyslog(prefix string) (io.WriteCloser, error)

Types

type Destination

type Destination int

Destination is a log destination.

const (
	// DestinationStdout writes logs to the standard output.
	DestinationStdout Destination = iota

	// DestinationFile writes logs to a file.
	DestinationFile

	// DestinationSyslog writes logs to the system logger.
	DestinationSyslog
)

type Level

type Level int

Level is a log level.

type LogConfig

type LogConfig struct {
	Level   string
	Verbose bool
	Syslog  bool
	LogFile string
}

type Logger

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

Logger is a log handler.

func New

func New(c LogConfig) (*Logger, error)

New allocates a log handler.

func (*Logger) Close

func (l *Logger) Close()

Close closes a log handler.

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error logs with the ERROR severity. Arguments are handled in the manner of fmt.Print.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf logs with the Error severity. Arguments are handled in the manner of fmt.Printf.

func (*Logger) Errorln

func (l *Logger) Errorln(v ...interface{})

Errorln logs with the ERROR severity. Arguments are handled in the manner of fmt.Println.

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

Fatal uses the default logger, logs with the sFatal severity, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Print.

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf uses the default logger, logs with the sFatal severity, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Printf.

func (*Logger) Fatalln

func (l *Logger) Fatalln(v ...interface{})

Fatalln uses the default logger, logs with the sFatal severity, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Println.

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

Info logs with the Info severity. Arguments are handled in the manner of fmt.Print.

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof logs with the Info severity. Arguments are handled in the manner of fmt.Printf.

func (*Logger) Infoln

func (l *Logger) Infoln(v ...interface{})

Infoln logs with the Info severity. Arguments are handled in the manner of fmt.Println.

func (*Logger) Log

func (l *Logger) Log(level Level, format string, args ...interface{})

Log writes a log entry.

func (*Logger) Warning

func (l *Logger) Warning(v ...interface{})

Warning logs with the Warning severity. Arguments are handled in the manner of fmt.Print.

func (*Logger) Warningf

func (l *Logger) Warningf(format string, v ...interface{})

Warningf logs with the Warning severity. Arguments are handled in the manner of fmt.Printf.

func (*Logger) Warningln

func (l *Logger) Warningln(v ...interface{})

Warningln logs with the Warning severity. Arguments are handled in the manner of fmt.Println.

Jump to

Keyboard shortcuts

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