log

package
v1.0.49 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 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 {
	Output      io.Writer
	ErrorOutput io.Writer
}

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

It can be enabled using the --debug flag.

func (DebugLogger) LogDebug added in v1.0.26

func (l DebugLogger) LogDebug(message string)

func (DebugLogger) LogError added in v1.0.19

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 {
	ErrorOutput io.Writer
}

The DefaultLogger does not output any information on standard output.

It only shows error output on standard error.

func (DefaultLogger) LogDebug added in v1.0.26

func (l DefaultLogger) LogDebug(message string)

func (DefaultLogger) LogError added in v1.0.19

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 {
	LogDebug(message string)
	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