File size: 874 Bytes
ef987bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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() }