Documentation
¶
Index ¶
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func FileLogger(content any, fileName, fileExtension string) error
- func FileLoggerWithPath(content any, path string) error
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Init()
- func LogRequest(req *http.Request)
- func LogResponse(response *http.Response)
- func SetupAndStartProcess(processName string, cmd *exec.Cmd) error
- func SetupProcessLogger(processName string) (*ProcessOutputReader, *ProcessOutputReader, *os.File, *os.File, error)
- func StatsLogger(ctx context.Context, statsFunc func() (int64, int64, int64))
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type ProcessOutputReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf writes record into os.stdout with log level DEBUG
func Errorf ¶
func Errorf(format string, v ...interface{})
Error writes record into os.stdout with log level ERROR
func Fatal ¶
func Fatal(v ...interface{})
Fatal writes record into os.stdout with log level ERROR and exits
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatal writes record into os.stdout with log level ERROR
func FileLogger ¶
CreateFile creates a new file or overwrites an existing one with the specified filename, path, extension,
func FileLoggerWithPath ¶ added in v0.2.1
func Infof ¶
func Infof(format string, v ...interface{})
Info writes record into os.stdout with log level INFO
func LogRequest ¶
func LogResponse ¶
func SetupAndStartProcess ¶
SetupAndStartProcess creates and starts a process with stdout and stderr logged via the logger. It handles the complete process lifecycle including starting the command and managing pipes.
func SetupProcessLogger ¶
func SetupProcessLogger(processName string) (*ProcessOutputReader, *ProcessOutputReader, *os.File, *os.File, error)
SetupProcessLogger creates stdout and stderr readers for a process and returns write-ends that should be connected to the process stdout and stderr
Types ¶
type ProcessOutputReader ¶
type ProcessOutputReader struct {
Name string // Name to identify the process in logs
IsError bool // Whether this reader handles error output
// contains filtered or unexported fields
}
ProcessOutputReader is a struct that manages reading output from a process and forwarding it to the logger
func NewProcessLogger ¶
NewProcessOutputReader creates a new ProcessOutputReader for a given process name is a prefix to identify the process in logs isError determines whether to log as Error (true) or Info (false) returns the reader and a write end that should be connected to the process output
func (*ProcessOutputReader) StartReading ¶
func (p *ProcessOutputReader) StartReading()
StartReading starts reading from the process output in a goroutine and logging each line with the appropriate log level