Documentation
¶
Overview ¶
Package generator provides log generation functionality for the genlog tool. It contains the core logic for creating fake log entries based on templates and random data generation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is responsible for generating fake log entries based on the provided configuration. It handles template selection, random value generation, and output management.
func NewGenerator ¶
NewGenerator creates a new log generator with the given configuration. It initializes the function map for template rendering and calculates the total template weight for weighted random selection.
The function map includes all custom types from the configuration, making them available as placeholders in templates.
func (*Generator) Done ¶ added in v0.1.5
func (g *Generator) Done() chan struct{}
Done returns a channel that is closed when the generator has completed generating the requested number of logs
func (*Generator) GenerateLogLine ¶
GenerateLogLine generates a single log line using a randomly selected template. This is useful for generating log lines programmatically without writing to a file, such as when streaming logs directly to another system.