log

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 13 Imported by: 12

Documentation

Overview

Package log provides a set of functions for logging to the console and storing the output in a buffer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionLog

func ActionLog(Header string, char rune)

ActionLog It takes a string and a rune as input, and prints a header with the string in the middle, and the rune as the border - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogDT added in v0.2.1

func ActionLogDT(Header string, char rune)

ActionLogDT is a function that takes a string and a rune as arguments and prints a header with the string , and the rune as the border It also prints the date and time in the middle of the header - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogDateFail added in v0.2.1

func ActionLogDateFail(Header string, char rune)

ActionLogDateFail() is a function that takes a string and a rune as arguments and print a red "Fail" message to the console with a red border and the date and time - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogDateOK added in v0.2.1

func ActionLogDateOK(Header string, char rune)

ActionLogDateOK() is a function that takes a string and a rune as arguments and print a green "OK" message to the console with a green border and the date and time - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogFail

func ActionLogFail(Header string, char rune)

ActionLogFail() is a function that takes a string and a rune as arguments and prints a red "Fail" message to the console - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogGreen added in v0.2.2

func ActionLogGreen(Header string, char rune)

ActionLogGreen() is a function that takes a string and a rune as arguments and returns nothing It prints a green "OK" message to the console with green border - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogOK

func ActionLogOK(Header string, char rune)

ActionLogOK() is a function that takes a string and a rune as arguments and returns nothing It prints a green "OK" message to the console - Header: the string to print in the middle of the header - char: the rune to use as the border

func ActionLogRed added in v0.2.2

func ActionLogRed(Header string, char rune)

ActionLogRed() is a function that takes a string and a rune as arguments and prints a red "Fail" message to the console with a red border - Header: the string to print in the middle of the header - char: the rune to use as the border

func FormatResults

func FormatResults(title string, data interface{}, format string) error

`FormatResults` is a function that takes a string, an interface and a string as arguments and formats the data before printing it to the console - title: the string to print in the middle of the header - data: the interface to print - format: the format to use to print the data

  • json
  • yaml
  • toml
  • xml
  • plain
  • default: json

- returns an error

func LogInterfaceVerbose

func LogInterfaceVerbose(data interface{})

`LogInterfaceVerbose` is a function that takes an interface and prints it to the console in magenta - data: the interface to print

func LogVerbose

func LogVerbose(msg string)

`LogVerbose` is a function that takes a string and prints it to the console in magenta - msg: the string to print

func PrintFail

func PrintFail(msg string)

`PrintFail` prints a message and fail in red color - msg: the string to print

func PrintOK

func PrintOK(msg string)

`PrintOK` prints a message and OK in green color - msg: the string to print

func PrintlnFail

func PrintlnFail(msg string)

`PrintlnFail` prints a message and fail in red color - msg: the string to print

func PrintlnOK

func PrintlnOK(msg string)

`PrintlnOK` prints a message in green color OK - msg: the string to print

Types

type LogStreamer

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

LogStreamer is a io.Writer that logs to the console and stores the output in a buffer

func (*LogStreamer) String

func (l *LogStreamer) String() string

Gets the log streamer output as a string

func (*LogStreamer) Write

func (l *LogStreamer) Write(p []byte) (n int, err error)

Write implements the io.Writer interface It writes the output to the console and the buffer - p: the data to write - returns: the number of bytes written and an error if there is one

Jump to

Keyboard shortcuts

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