printer

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CI

func CI(opt interface{}) error

CI - enable only log messages to CLI output

func IsInitialized

func IsInitialized() bool

IsInitialized returns true if printer is ready, false otherwise

func LogFile

func LogFile(opt interface{}, changed bool) error

LogFile - enables write to log file

func LogFormat

func LogFormat(logFormat string) error

LogFormat - configures the logs format (JSON,pretty).

func LogLevel

func LogLevel(opt interface{}, changed bool) error

LogLevel - sets log level

func LogPath

func LogPath(opt interface{}, changed bool) error

LogPath - sets the log files location

func NewLogger

func NewLogger(logs *LogSink) zerolog.Logger

func NoColor

func NoColor(opt interface{}, changed bool) error

NoColor - disables ASCII color codes

func PrintResult

func PrintResult(summary *model.Summary, printer *Printer, usingCustomQueries bool) error

PrintResult prints on output the summary results

func PrintScanDuration

func PrintScanDuration(logger *zerolog.Logger, elapsed time.Duration)

PrintScanDuration prints the scan duration

func SetupPrinter

func SetupPrinter(flags *pflag.FlagSet) error

SetupPrinter - configures stdout and log options with given FlagSet

func Silent

func Silent(opt interface{}) error

Silent - disables stdout output

func Verbose

func Verbose(opt interface{}, changed bool) error

Verbose - redirects log entries to stdout

func WordWrap

func WordWrap(s, indentation string, limit int) string

WordWrap Wraps text at the specified number of words

Types

type LogSink

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

func (*LogSink) Index

func (l *LogSink) Index(i int) string

func (*LogSink) Write

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

type Printer

type Printer struct {
	Critical            color.RGBColor
	Medium              color.RGBColor
	High                color.RGBColor
	Low                 color.RGBColor
	Info                color.RGBColor
	Success             color.RGBColor
	Line                color.RGBColor
	VersionMessage      color.RGBColor
	ContributionMessage color.RGBColor
	// contains filtered or unexported fields
}

Printer wil print console output with colors Medium is for medium sevevity results High is for high sevevity results Low is for low sevevity results Info is for info sevevity results Success is for successful prints Line is the color to print the line with the vulnerability minVersion is a bool that if true will print the results output in a minimum version

func NewPrinter

func NewPrinter(minimal bool) *Printer

NewPrinter initializes a new Printer

func (*Printer) Bold

func (p *Printer) Bold(content string) string

Bold returns the output in a bold format

func (*Printer) PrintBySev

func (p *Printer) PrintBySev(content, sev string) string

PrintBySev will print the output with the specific severity color given the severity of the result

Jump to

Keyboard shortcuts

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