UXInteract / task_047 /environment /code /log_analyzer.go
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
Raw History Blame Contribute Delete
874 Bytes
package loganalyzer
import "net/http"
type Log struct {
ID string `json:"id"`
Message string `json:"message"`
Level string `json:"level"`
Timestamp string `json:"timestamp"`
Tag string `json:"tag"`
}
type Repository interface {
Save(log Log) error
Get(id string) (Log, bool)
}
func GenerateTag(log Log) string { return "" }
func NewMemoryRepository() Repository { return nil }
func NewFileRepository(path string) Repository { return nil }
func NewRepositoryFromConfig(kind string, path string) Repository { return nil }
type Service struct {
Repo Repository
}
func NewService(repo Repository) *Service { return &Service{Repo: repo} }
func (s *Service) Process(log Log) (Log, error) { return log, nil }
func NewHandler(repo Repository) http.Handler { return http.NewServeMux() }