logging

package
v0.0.0-...-7ad0b1f Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logging provides utilities to easily set a universal log level, as well as intuitively set a log file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug prints debug logs.

func Debugf

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

Debugf prints debug logs with a formatting directive.

func Debugln

func Debugln(args ...interface{})

Debugln prints debug logs, followed by a new line.

func Error

func Error(args ...interface{})

Error prints error logs.

func Errorf

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

Errorf prints error logs with a formatting directive.

func Errorln

func Errorln(args ...interface{})

Errorln prints error logs, followed by a new line.

func Fatal

func Fatal(args ...interface{})

Fatal prints a message, then calls os.Exit(1).

func Fatalf

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

Fatalf prints a message with a formatting directive, then calls os.Exit(1).

func Fatalln

func Fatalln(args ...interface{})

Fatalln prints a message and a new line, then calls os.Exit(1).

func Info

func Info(args ...interface{})

Info prints info logs.

func Infof

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

Infof prints info logs with a formatting directive.

func Infoln

func Infoln(args ...interface{})

Infoln prints info logs, followed by a new line.

func SetLogFile

func SetLogFile(logFile io.Writer)

SetLogFile sets a file to write to in addition to standard output.

func SetLogLevel

func SetLogLevel(newLevel int)

SetLogLevel sets the global log level

func Warn

func Warn(args ...interface{})

Warn prints warning logs.

func Warnf

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

Warnf prints warning logs with a formatting directive.

func Warnln

func Warnln(args ...interface{})

Warnln prints warning logs, followed by a new line.

Types

type LogLevel

type LogLevel int

LogLevel indicates what to log based on the method called

const (
	// LogLevelError is the log level that prints Panics, Fatals, and Errors.
	LogLevelError LogLevel = 0
	// LogLevelWarning is the log level that prints Panics, Fatals, Errors, and Warnings.
	LogLevelWarning LogLevel = 1
	// LogLevelInfo is the log level that prints Panics, Fatals, Errors, Warnings, and Infos.
	LogLevelInfo LogLevel = 2
	// LogLevelDebug is the log level that prints Panics, Fatals, Errors, Warnings, Infos, and Debugs.
	LogLevelDebug LogLevel = 3
)

Jump to

Keyboard shortcuts

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