log

package
v0.0.0-...-a4bf063 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level is the logging level: None, Error, Warn, Info, Verbose, or Debug

const (
	// Error means that only errors will be written
	// Maps to server.Error
	Error Level = iota

	// Warn means that errors and warnings will be written
	// Maps to server.Warning
	Warn

	// Info logging writes info, warning, and error
	// Maps to server.Info
	Info

	// Verbose logs everything bug debug-level messages
	// Maps to server.Log
	Verbose

	// Debug logs every message
	// Debug level messages will not be reported to the language server client
	Debug
)

type Log

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

Log is a fairly basic logger

func CreateLog

func CreateLog(w io.Writer) *Log

CreateLog will return a log for the given name, creating one with the provided writer as needed

func Stderr

func Stderr() *Log

Stderr gets the log for os.Stderr

func Stdout

func Stdout() *Log

Stdout gets the log for os.Stdout

func (*Log) Debugf

func (l *Log) Debugf(msg string, v ...interface{})

Debugf will write if the log level is at least Debug. If the pointer receiver is nil, the log for `os.Stdout` will be used.

func (*Log) Errorf

func (l *Log) Errorf(msg string, v ...interface{})

Errorf will write if the log level is at least Error. If the pointer receiver is nil, the log for `os.Stdout` will be used.

func (*Log) Infof

func (l *Log) Infof(msg string, v ...interface{})

Infof will write if the log level is at least Info. If the pointer receiver is nil, the log for `os.Stdout` will be used.

func (*Log) Printf

func (l *Log) Printf(msg string, v ...interface{})

Printf will always log the given message, regardless of log level set. If the pointer receiver is nil, the log for `os.Stdout` will be used.

func (*Log) SetLevel

func (l *Log) SetLevel(lvl Level)

SetLevel will adjust the logger's level. If the pointer receiver is nil, the log for `os.Stdout` will be used.

func (*Log) Verbosef

func (l *Log) Verbosef(msg string, v ...interface{})

Verbosef will write if the log level is at least Verbose. If the pointer receiver is nil, the log for `os.Stdout` will be used.

func (*Log) Warnf

func (l *Log) Warnf(msg string, v ...interface{})

Warnf will write if the log level is at least Warn. If the pointer receiver is nil, the log for `os.Stdout` will be used.

type Logger

type Logger interface {
	// Debugf will write if the log level is at least Debug.
	Debugf(msg string, v ...interface{})

	// Errorf will write if the log level is at least Error.
	Errorf(msg string, v ...interface{})

	// Infof will write if the log level is at least Info.
	Infof(msg string, v ...interface{})

	// Printf will always log the given message, regardless of log level set.
	Printf(msg string, v ...interface{})

	// SetLevel will adjust the logger's level.
	SetLevel(lvl Level)

	// Verbosef will write if the log level is at least Verbose.
	Verbosef(msg string, v ...interface{})

	// Warnf will write if the log level is at least Warn.
	Warnf(msg string, v ...interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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