log

package
v1.0.107 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package log provides an API to log diagnostics information which is used to give the user more details about what is happening inside of the CLI.

- Stores full request and response information - Provides data to root-cause problems

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugLogger

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

The DebugLogger provides more insights into which operations the CLI is performing.

It can be enabled using the --debug flag.

func NewDebugLogger

func NewDebugLogger(writer io.Writer) *DebugLogger

func (DebugLogger) LogError

func (l DebugLogger) LogError(message string)

func (*DebugLogger) LogRequest

func (l *DebugLogger) LogRequest(request RequestInfo)

func (DebugLogger) LogResponse

func (l DebugLogger) LogResponse(response ResponseInfo)

type DefaultLogger

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

The DefaultLogger does not output any information on standard output.

It only shows error output on standard error.

func NewDefaultLogger

func NewDefaultLogger(writer io.Writer) *DefaultLogger

func (DefaultLogger) LogError

func (l DefaultLogger) LogError(message string)

func (*DefaultLogger) LogRequest

func (l *DefaultLogger) LogRequest(request RequestInfo)

func (DefaultLogger) LogResponse

func (l DefaultLogger) LogResponse(response ResponseInfo)

type Logger

type Logger interface {
	LogError(message string)
	LogRequest(request RequestInfo)
	LogResponse(response ResponseInfo)
}

The Logger interface which is used to provide additional information to the user about what operations the CLI is performing.

type RequestInfo

type RequestInfo struct {
	Method   string
	Url      string
	Protocol string
	Header   map[string][]string
	Body     io.Reader
}

RequestInfo contains the information used by the logger to print debug information which includes the request information.

func NewRequestInfo

func NewRequestInfo(method string, url string, protocol string, header map[string][]string, body io.Reader) *RequestInfo

type ResponseInfo

type ResponseInfo struct {
	StatusCode int
	Status     string
	Protocol   string
	Header     map[string][]string
	Body       io.Reader
}

ResponseInfo contains the information used by the logger to print the executor result.

func NewResponseInfo

func NewResponseInfo(statusCode int, status string, protocol string, header map[string][]string, body io.Reader) *ResponseInfo

Jump to

Keyboard shortcuts

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