log

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(style string, level int64) contract.Logger

New creates a new logger based on the provided log style & level.

func NewFestive

func NewFestive(level int64) contract.Logger

NewFestive creates a new Festive logger style instance.

func NewPlain

func NewPlain(level int64) contract.Logger

NewPlain creates a new Plain logger style instance.

Types

type Festive

type Festive struct{}

Festive - a colorized test execution log style.

func (Festive) Default

func (log Festive) Default(args ...interface{}) string

Default marks up the default output.

func (Festive) Error

func (log Festive) Error(args ...interface{}) string

Success marks up the unsuccessful testing of operation properties.

func (Festive) Failure

func (log Festive) Failure(args ...interface{}) string

Failure marks up the unsuccesfful operation testing result.

func (Festive) ID

func (log Festive) ID(args ...interface{}) string

ID marks up indentifiers.

func (Festive) Method

func (log Festive) Method(args ...interface{}) string

Method marks up HTTP methods.

func (Festive) OK

func (log Festive) OK(args ...interface{}) string

OK marks up the successful operation testing result.

func (Festive) Op

func (log Festive) Op(args ...interface{}) string

Op marks up operation names.

func (Festive) Success

func (log Festive) Success(args ...interface{}) string

Success marks up the successful testing of operation properties.

func (Festive) URL

func (log Festive) URL(args ...interface{}) string

URL marks up URLs.

func (Festive) Value

func (log Festive) Value(args ...interface{}) string

Value marks up values.

func (Festive) ValueActual

func (log Festive) ValueActual(args ...interface{}) string

ValueActual marks up actual received values.

func (Festive) ValueExpected

func (log Festive) ValueExpected(args ...interface{}) string

ValueExpected marks up expected values.

type IStyle

type IStyle interface {
	Default(...interface{}) string
	URL(...interface{}) string
	Method(...interface{}) string
	Op(...interface{}) string
	OK(...interface{}) string
	Failure(...interface{}) string
	Success(...interface{}) string
	Error(...interface{}) string
	ID(...interface{}) string
	ValueExpected(...interface{}) string
	ValueActual(...interface{}) string
}

IStyle is an interface to log styling.

type Log

type Log struct {
	Level int64
	Style contract.LogStyle
}

Log is a base type for loggers.

func (Log) Error

func (log Log) Error(err error)

Error outputs errors. It accepts both built-in errors as well as errors.IError instances. The latter carry their cause error, if any, and those will be recursively printed.

func (Log) Expecting

func (log Log) Expecting(what string, v string)

Expecting informs that a parameter example being used.

func (Log) ExpectingProperty

func (log Log) ExpectingProperty(what string, v string)

ExpectingProperty informs that a parameter example being used.

func (Log) HeaderHasNoValue

func (log Log) HeaderHasNoValue(hdr string)

HeaderHasNoValue informs that a required response header has no data.

func (Log) LoadingScript

func (log Log) LoadingScript(path string)

LoadingScript informs about the API specification being used.

func (Log) LoadingSpec

func (log Log) LoadingSpec(path string)

LoadingSpec informs about the API specification being used.

func (Log) NOMESSAGE

func (log Log) NOMESSAGE(msg string, args ...interface{})

NOMESSAGE is a default and temporary print function to use when you don't have a dedidated message function in the logger. It is meant to be replaced eventually with a proper logging method or removed. Henec the indicating name.

func (Log) OperationFail

func (log Log) OperationFail()

OperationFail informs that the operation has failed.

func (Log) OperationOK

func (log Log) OperationOK()

OperationOK informs that the operation has finished successfully.

func (Log) Parameters

func (log Log) Parameters(name string, params contract.ParameterSource)

Parameters prints a ParameterSource contents.

func (Log) Print

func (log Log) Print(l int64, msg string, args ...interface{})

Print prints.

func (Log) PrintOperations

func (log Log) PrintOperations(ops contract.OperationIterator)

PrintOperations prints the list of available operations.

func (Log) Println

func (log Log) Println(l int64, msg string, args ...interface{})

Println prints and adds a newline.

func (Log) Requesting

func (log Log) Requesting(method string, URL string)

Requesting informs about an HTTP request being performed.

func (Log) ResponseHasWrongContentType

func (log Log) ResponseHasWrongContentType(expectedCT string, actualCT string)

ResponseHasWrongContentType informs that the received response has wrong/unexpected Content-Type header value.

func (Log) ResponseHasWrongPropertyValue

func (log Log) ResponseHasWrongPropertyValue(propName string, expected string, actual string)

ResponseHasWrongPropertyValue informs that the received response has wrong/unexpected body property value.

func (Log) ResponseHasWrongStatus

func (log Log) ResponseHasWrongStatus(expectedStatus int, actualStatus int)

ResponseHasWrongStatus informs that the received response has wrong/unexpected status.

func (Log) SchemaFail

func (log Log) SchemaFail(schemaName string, errors []gojsonschema.ResultError)

SchemaFail informs that JSON schema testing finished unsuccessfully.

func (Log) SchemaOK

func (log Log) SchemaOK(schemaName string)

SchemaOK informs that JSON schema testing finished successfully.

func (Log) SchemaTesting

func (log Log) SchemaTesting(schema *api.Schema, data interface{})

SchemaTesting informs about a value being tested againt some JSON schema.

func (Log) ScriptExecutionStart

func (log Log) ScriptExecutionStart(node string)

ScriptExecutionStart logs the starting node of the script execution graph.

func (Log) SecurityHasNoData

func (log Log) SecurityHasNoData(sec contract.Security)

SecurityHasNoData informs that the selected security settings has no data to use in requests.

func (Log) TestingOperation

func (log Log) TestingOperation(op contract.Operation)

TestingOperation informs about an operation being tested.

func (Log) TestingProject

func (log Log) TestingProject(pi contract.ProjectInfo)

TestingProject informs about the project being tested.

func (Log) Usage

func (log Log) Usage()

Usage prints CLI usage information.

func (Log) UsingParameterExample

func (log Log) UsingParameterExample(paramName string, in string, container string, value string)

UsingParameterExample informs that a parameter example being used.

func (Log) UsingSecurity

func (log Log) UsingSecurity(sec contract.Security)

UsingSecurity informs about security mechanisms being used during testing.

func (Log) XError

func (log Log) XError(err error, style contract.LogStyle, tab contract.TabFn)

XError is an internal error handling function. It handles both built-in errors and errors.IError instances.

type Plain

type Plain struct{}

Plain - a plain & simple test execution logger style.

func (Plain) Default

func (log Plain) Default(args ...interface{}) string

Default marks up the default output.

func (Plain) Error

func (log Plain) Error(args ...interface{}) string

Success marks up the unsuccessful testing of operation properties.

func (Plain) Failure

func (log Plain) Failure(args ...interface{}) string

Failure marks up the unsuccesfful operation testing result.

func (Plain) ID

func (log Plain) ID(args ...interface{}) string

ID marks up indentifiers.

func (Plain) Method

func (log Plain) Method(args ...interface{}) string

Method marks up HTTP methods.

func (Plain) OK

func (log Plain) OK(args ...interface{}) string

OK marks up the successful operation testing result.

func (Plain) Op

func (log Plain) Op(args ...interface{}) string

Op marks up operation names.

func (Plain) Success

func (log Plain) Success(args ...interface{}) string

Success marks up the successful testing of operation properties.

func (Plain) URL

func (log Plain) URL(args ...interface{}) string

URL marks up URLs.

func (Plain) Value

func (log Plain) Value(args ...interface{}) string

Value marks up values.

func (Plain) ValueActual

func (log Plain) ValueActual(args ...interface{}) string

ValueActual marks up actual received values.

func (Plain) ValueExpected

func (log Plain) ValueExpected(args ...interface{}) string

ValueExpected marks up expected values.

Jump to

Keyboard shortcuts

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