Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeFormatter ¶
InitializeFormatter creates a singleton Formatter
Types ¶
type Formatter ¶
type Formatter interface { PrintItem(item interface{}) error PrintList(items interface{}) error PrintError(context string, err error) PrintFatal(context string, err error) }
Formatter defines output printing interface
type JSONFormatter ¶
type JSONFormatter struct {
// contains filtered or unexported fields
}
JSONFormatter prints items and lists in JSON format
func NewJSONFormatter ¶
func NewJSONFormatter(out io.Writer) *JSONFormatter
NewJSONFormatter creates a new JSONFormatter
func (*JSONFormatter) PrintError ¶
func (f *JSONFormatter) PrintError(context string, err error)
PrintError prints an error
func (*JSONFormatter) PrintFatal ¶
func (f *JSONFormatter) PrintFatal(context string, err error)
PrintFatal prints an error and exists
func (*JSONFormatter) PrintItem ¶
func (f *JSONFormatter) PrintItem(item interface{}) error
PrintItem prints an item
func (*JSONFormatter) PrintList ¶
func (f *JSONFormatter) PrintList(items interface{}) error
PrintList prints item list
type JSONMessage ¶
type JSONMessage struct { Type string `json:"type"` Context string `json:"context,omitempty"` Message string `json:"message"` }
JSONMessage hosts generic messages
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
TextFormatter prints items and lists
func NewTextFormatter ¶
func NewTextFormatter(out io.Writer) *TextFormatter
NewTextFormatter creates a new TextFormatter
func (*TextFormatter) PrintError ¶
func (f *TextFormatter) PrintError(context string, err error)
PrintError prints an error
func (*TextFormatter) PrintFatal ¶
func (f *TextFormatter) PrintFatal(context string, err error)
PrintFatal prints an error and exists
func (*TextFormatter) PrintItem ¶
func (f *TextFormatter) PrintItem(item interface{}) error
PrintItem prints item
func (*TextFormatter) PrintList ¶
func (f *TextFormatter) PrintList(items interface{}) error
PrintList prints item list
Click to show internal directories.
Click to hide internal directories.