-
Notifications
You must be signed in to change notification settings - Fork 520
/
service.go
36 lines (32 loc) · 871 Bytes
/
service.go
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
36
// Copyright 2019 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package applog
import (
"github.com/pkg/errors"
"github.com/tsuru/config"
appTypes "github.com/tsuru/tsuru/types/app"
)
const (
promNamespace = "tsuru"
)
func AppLogService() (appTypes.AppLogService, error) {
appLogSvc, _ := config.GetString("log:app-log-service")
if appLogSvc == "" {
appLogSvc = "memory-standalone"
}
var svc appTypes.AppLogService
var err error
switch appLogSvc {
case "memory-standalone":
svc, err = memoryAppLogService()
case "memory":
svc, err = aggregatorAppLogService()
default:
return nil, errors.New(`invalid app log service, valid values are: "memory" or "memory-standalone"`)
}
if err != nil {
return nil, err
}
return newProvisionerWrapper(svc), nil
}