forked from aws/aws-lambda-runtime-interface-emulator
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
118 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.