-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandlerExecution.go
More file actions
36 lines (29 loc) · 913 Bytes
/
HandlerExecution.go
File metadata and controls
36 lines (29 loc) · 913 Bytes
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
package example
import (
"fmt"
"time"
)
type BackupHandler struct {
lastOpID string
log func(message ...any)
}
func (h *BackupHandler) Name() string { return "SystemBackup" }
func (h *BackupHandler) Label() string { return "With Tracking" }
// SetLog receives the logger from DevTUI
func (h *BackupHandler) SetLog(logger func(message ...any)) {
h.log = logger
}
func (h *BackupHandler) Execute() {
if h.log == nil {
h.log = func(message ...any) { fmt.Println(message...) }
}
h.log("Preparing backup... " + h.lastOpID)
time.Sleep(500 * time.Millisecond)
h.log("BackingUp database... " + h.lastOpID)
time.Sleep(500 * time.Millisecond)
h.log("BackingUp Files " + h.lastOpID)
time.Sleep(500 * time.Millisecond)
h.log("Backup End OK " + h.lastOpID)
}
func (h *BackupHandler) GetCompactID() string { return h.lastOpID }
func (h *BackupHandler) SetCompactID(id string) { h.lastOpID = id }