Closed alexandernilsson closed 7 years ago
Hi,
As we use the vanilla Go log package and more precisely its singleton version. You are free to reset the output writer. Here is an example:
package main
import (
"fmt"
"log"
"testing"
)
type mockLogger struct{}
func (l *mockLogger) Write(info []byte) (int, error) {
fmt.Printf(string(info))
return len(info), nil
}
func TestHandle(*testing.T) {
log.SetOutput(&mockLogger{})
handle(nil, nil)
}
Does this suit your needs?
Yes, that works!
This might be a good thing to put in the README in case someone else runs into it?
Good to know :smile:.
As you suggest, we will update README ASAP.
Enjoy playing :jack_o_lantern:
I started playing around with this package, but when writing test and running them locally the process dies with a SIGSEGV as soon as the log package is called.
Would it be possible to only override the log package when running in AWS Lambda, and logging normally during runs outside of it?