forked from aws/aws-lambda-runtime-interface-emulator
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlogs_egress_api.go
More file actions
31 lines (24 loc) · 1.12 KB
/
logs_egress_api.go
File metadata and controls
31 lines (24 loc) · 1.12 KB
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
package main
import (
"io"
"os"
)
// This LocalStack LogsEgressAPI builder allows to customize log capturing, in our case using the logCollector.
type LocalStackLogsEgressAPI struct {
logCollector *LogCollector
}
func NewLocalStackLogsEgressAPI(logCollector *LogCollector) *LocalStackLogsEgressAPI {
return &LocalStackLogsEgressAPI{
logCollector: logCollector,
}
}
// The interface StdLogsEgressAPI for the functions below is defined in the under cmd/localstack/logs_egress_api.go
// The default implementation is a NoOpLogsEgressAPI
func (s *LocalStackLogsEgressAPI) GetExtensionSockets() (io.Writer, io.Writer, error) {
// os.Stderr can not be used for the stderrWriter because stderr is for internal logging (not customer visible).
return io.MultiWriter(s.logCollector, os.Stdout), io.MultiWriter(s.logCollector, os.Stdout), nil
}
func (s *LocalStackLogsEgressAPI) GetRuntimeSockets() (io.Writer, io.Writer, error) {
// os.Stderr can not be used for the stderrWriter because stderr is for internal logging (not customer visible).
return io.MultiWriter(s.logCollector, os.Stdout), io.MultiWriter(s.logCollector, os.Stdout), nil
}