-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype_schedule.go
37 lines (32 loc) · 945 Bytes
/
type_schedule.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
37
package telescope
import (
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
"time"
)
// Schedule @Bean
type Schedule struct {
Command string `json:"command"`
Description interface{} `json:"description"`
Expression string `json:"expression"`
Timezone string `json:"timezone"`
User interface{} `json:"user"`
Output string `json:"output"`
Hostname string `json:"hostname"`
}
func (s *Schedule) BindType() string {
return "schedule"
}
func (s *Schedule) Handler(entry *logrus.Entry) (*entries, []tag) {
b := *s
b.Command = entry.Message
return &entries{
Uuid: uuid.NewV4().String(),
BatchId: NewtelescopeHook().TelescopeUUID(),
FamilyHash: nil,
ShouldDisplayOnIndex: 1,
Type: b.BindType(),
Content: ToContent(b),
CreatedAt: time.Now().Format("2006-01-02 15:04:05"),
}, nil
}