log

package
v0.0.0-...-b2a0db9 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package log is a context based logging package, designed to interact well with both the lsp protocol and the other telemetry packages.

Index

Constants

View Source
const (
	// The well known tag keys for the logging system.
	MessageTag = tag.Key("message")
	ErrorTag   = tag.Key("error")
)

Variables

This section is empty.

Functions

func AddLogger

func AddLogger(logger Logger)

func Error

func Error(ctx context.Context, message string, err error, tags ...tag.Tagger)

Print takes a message and a tag list and combines them into a single tag list before delivering them to the loggers.

func Print

func Print(ctx context.Context, message string, tags ...tag.Tagger)

Print takes a message and a tag list and combines them into a single tag list before delivering them to the loggers.

func Stderr

func Stderr(ctx context.Context, at time.Time, tags tag.List) bool

Stderr is a logger that logs to stderr in the standard format.

func With

func With(ctx context.Context, tags ...tag.Tag)

With sends a tag list to the installed loggers.

Types

type Entry

type Entry struct {
	At      time.Time
	Message string
	Error   error
	Tags    tag.List
}

func ToEntry

func ToEntry(ctx context.Context, at time.Time, tags tag.List) Entry

func (Entry) Format

func (e Entry) Format(f fmt.State, r rune)

type Logger

type Logger func(ctx context.Context, at time.Time, tags tag.List) bool

Logger is a function that handles logging messages. Loggers are registered at start up, and may use information in the context to decide what to do with a given log message.

Jump to

Keyboard shortcuts

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