log

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package log is a wrapper around the fmt package to print messages to the terminal.

Index

Constants

This section is empty.

Variables

View Source
var (
	DiagnosticWriter = color.Error
	OutputWriter     = color.Output
)

Decorated io.Writers around standard error and standard output that work on Windows.

Functions

func Debug

func Debug(args ...interface{})

Debug writes the message to standard error in grey.

func Debugf

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

Debugf formats according to the specifier, colors the message in grey, and writes to standard error.

func Debugln

func Debugln(args ...interface{})

Debugln writes the message to standard error in grey and with a new line.

func Error

func Error(args ...interface{})

Error prefixes the message with a red "✘ Error!", and writes to standard error.

func Errorf

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

Errorf formats according to the specifier, prefixes the message with a red "✘ Error!", and writes to standard error.

func Errorln

func Errorln(args ...interface{})

Errorln prefixes the message with a red "✘ Error!", and writes to standard error with a new line.

func Info

func Info(args ...interface{})

Info writes the message to standard error with the default color.

func Infof

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

Infof formats according to the specifier, and writes to standard error with the default color.

func Infoln

func Infoln(args ...interface{})

Infoln writes the message to standard error with the default color and new line.

func Serror

func Serror(args ...interface{}) string

Serror prefixes the message with a red "✘ Error!", and returns it.

func Serrorf

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

Serrorf formats according to the specifier, prefixes the message with a red "✘ Error!", and returns it.

func Serrorln

func Serrorln(args ...interface{}) string

Serrorln prefixes the message with a red "✘ Error!", appends a new line, and returns it.

func Ssuccess

func Ssuccess(args ...interface{}) string

Ssuccess prefixes the message with a green "✔ Success!", and returns it.

func Ssuccessf

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

Ssuccessf formats according to the specifier, prefixes the message with a green "✔ Success!", and returns it.

func Ssuccessln

func Ssuccessln(args ...interface{}) string

Ssuccessln prefixes the message with a green "✔ Success!", appends a new line, and returns it.

func Success

func Success(args ...interface{})

Success prefixes the message with a green "✔ Success!", and writes to standard error.

func Successf

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

Successf formats according to the specifier, prefixes the message with a green "✔ Success!", and writes to standard error.

func Successln

func Successln(args ...interface{})

Successln prefixes the message with a green "✔ Success!", and writes to standard error with a new line.

func Warning

func Warning(args ...interface{})

Warning prefixes the message with a "Note:", colors the *entire* message in yellow, writes to standard error.

func Warningf

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

Warningf formats according to the specifier, prefixes the message with a "Note:", colors the *entire* message in yellow, and writes to standard error.

func Warningln

func Warningln(args ...interface{})

Warningln prefixes the message with a "Note:", colors the *entire* message in yellow, writes to standard error with a new line.

Types

type Logger added in v1.19.0

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

Logger represents a logging object that writes to an io.Writer lines of outputs.

func New added in v1.19.0

func New(w io.Writer) *Logger

New creates a new Logger.

func (*Logger) Debug added in v1.19.0

func (l *Logger) Debug(args ...interface{})

Debug writes the message.

func (*Logger) Debugf added in v1.19.0

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

Debugf formats according to the specifier, and writes the message.

func (*Logger) Debugln added in v1.19.0

func (l *Logger) Debugln(args ...interface{})

Debugln writes the message and with a new line.

func (*Logger) Error added in v1.19.0

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

Error writes args prefixed with "✘ Error!".

func (*Logger) Errorf added in v1.19.0

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

Errorf formats according to the specifier, prefixes the message with a "✘ Error!", and writes it.

func (*Logger) Errorln added in v1.19.0

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

Errorln writes args prefixed with a "✘ Error!" and a new line.

func (*Logger) Info added in v1.19.0

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

Info writes the message.

func (*Logger) Infof added in v1.19.0

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

Infof formats according to the specifier, and writes the message.

func (*Logger) Infoln added in v1.19.0

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

Infoln writes the message with a new line.

func (*Logger) Success added in v1.19.0

func (l *Logger) Success(args ...interface{})

Success writes args prefixed with a "✔ Success!".

func (*Logger) Successf added in v1.19.0

func (l *Logger) Successf(format string, args ...interface{})

Successf formats according to the specifier, prefixes the message with a "✔ Success!", and writes it.

func (*Logger) Successln added in v1.19.0

func (l *Logger) Successln(args ...interface{})

Successln writes args prefixed with a "✔ Success!" and a new line.

func (*Logger) Warning added in v1.19.0

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

Warning writes args prefixed with "Note:".

func (*Logger) Warningf added in v1.19.0

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

Warningf formats according to the specifier, prefixes the message with a "Note:", and writes it.

func (*Logger) Warningln added in v1.19.0

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

Warningln writes args prefixed with a "Note:" and a new line.

Jump to

Keyboard shortcuts

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