util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, args ...interface{})

func Error

func Error(format string, args ...interface{})

func Fatal

func Fatal(format string, args ...interface{})

Fatal logs a fatal message and exits.

func Info

func Info(format string, args ...interface{})

func SetColorEnabled

func SetColorEnabled(enabled bool)

func SetLogLevel

func SetLogLevel(level LogLevel)

exposed functions for global usage

func Warn

func Warn(format string, args ...interface{})

Types

type Colorizer

type Colorizer struct {
	Enabled bool
}

Colorizer manages colored CLI output.

func NewColorizer

func NewColorizer(forceEnabled bool) *Colorizer

NewColorizer creates a new Colorizer instance, detecting if colors should be enabled.

func (*Colorizer) Blue

func (c *Colorizer) Blue(text string) string

Blue colors the text blue.

func (*Colorizer) Cyan

func (c *Colorizer) Cyan(text string) string

Cyan colors the text cyan.

func (*Colorizer) Dim

func (c *Colorizer) Dim(text string) string

Dim dims the text.

func (*Colorizer) Green

func (c *Colorizer) Green(text string) string

Green colors the text green.

func (*Colorizer) Red

func (c *Colorizer) Red(text string) string

Red colors the text red.

func (*Colorizer) Yellow

func (c *Colorizer) Yellow(text string) string

Yellow colors the text yellow.

type LogLevel

type LogLevel int

LogLevel defines the severity of a log message.

const (
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

type Logger

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

Logger is a simple, concurrency-safe logger.

func NewLogger

func NewLogger(out io.Writer, level LogLevel, prefix string, colorize bool) *Logger

NewLogger creates a new Logger instance.

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

Debug logs a debug message.

func (*Logger) Error

func (l *Logger) Error(format string, args ...interface{})

Error logs an error message.

func (*Logger) Fatal

func (l *Logger) Fatal(format string, args ...interface{})

Fatal logs a fatal message and exits.

func (*Logger) Info

func (l *Logger) Info(format string, args ...interface{})

Info logs an informational message.

func (*Logger) SetColorEnabled

func (l *Logger) SetColorEnabled(enabled bool)

SetColorEnabled enables or disables colored output.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level LogLevel)

SetLevel sets the current logging level.

func (*Logger) Warn

func (l *Logger) Warn(format string, args ...interface{})

Warn logs a warning message.

type ResumeManager

type ResumeManager struct {
	TotalCount uint32 // Loaded total from previous run
	// contains filtered or unexported fields
}

ResumeManager handles tracking completed targets for resuming scans.

func NewResumeManager

func NewResumeManager(path string, enabled bool) (*ResumeManager, error)

NewResumeManager initializes the manager and loads existing progress if resume is enabled.

func (*ResumeManager) Cleanup

func (rm *ResumeManager) Cleanup()

Cleanup deletes the resume file (usually called when a scan finishes successfully).

func (*ResumeManager) Close

func (rm *ResumeManager) Close()

Close closes the resume file.

func (*ResumeManager) IsCompleted

func (rm *ResumeManager) IsCompleted(id string) bool

IsCompleted checks if a target ID has already been processed.

func (*ResumeManager) MarkCompleted

func (rm *ResumeManager) MarkCompleted(id string)

MarkCompleted saves a target ID to the resume file.

func (*ResumeManager) SaveTotal

func (rm *ResumeManager) SaveTotal(total uint32)

SaveTotal saves the total count to the resume file (only if file is empty/new).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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