This repository has been archived on 2025-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
Files
PKGBUILD/pkg/storage/logfile/logfile.go

31 lines
559 B
Go

package logfile
import (
"path/filepath"
)
// New returns a log file with basic functions for reading and writing data. The
// file extension of the logfile is taken into account to format the logfile
// into the correct format.
func New(logfile string) Logfile {
ext := filepath.Ext(logfile)
switch ext {
case ".csv":
return &csvLogfile{
logfile: logfile,
}
case ".json":
return &jsonLogfile{
logfile: logfile,
}
case ".xml":
return &xmlLogfile{
logfile: logfile,
}
default:
return &jsonLogfile{
logfile: logfile,
}
}
}