/
system_log.go
44 lines (41 loc) · 994 Bytes
/
system_log.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
38
39
40
41
42
43
44
package elem
import (
"github.com/Bitspark/slang/pkg/log"
"github.com/Bitspark/slang/pkg/core"
"github.com/google/uuid"
)
var systemLogId = uuid.MustParse("8f9c02df-da41-4266-b486-0c22173a6383")
var systemLogCfg = &builtinConfig{
safe: true,
blueprint: core.Blueprint{
Id: systemLogId,
Meta: core.BlueprintMetaDef{
Name: "log",
ShortDescription: "Logs any value passed through the configured logger",
Icon: "align-center",
Tags: []string{"system"},
DocURL: "https://bitspark.de/slang/docs/operator/log",
},
ServiceDefs: map[string]*core.ServiceDef{
core.MAIN_SERVICE: {
In: core.TypeDef{
Type: "generic",
Generic: "valueType",
},
Out: core.TypeDef{
Type: "generic",
Generic: "valueType",
},
},
},
},
opFunc: func(op *core.Operator) {
in := op.Main().In()
out := op.Main().Out()
for !op.CheckStop() {
i := in.Pull()
log.Print(i)
out.Push(i)
}
},
}