justtrackio / gosoline

Gosoline is our framework which fuels all of our Golang applications
MIT License
93 stars 50 forks source link

suite, env: Implement optional recording of emitted logs for use in test assertions #1103

Closed bt-justtrack closed 5 months ago

bt-justtrack commented 5 months ago

This adds the new RecordingLogger interface which wraps the gosoline log.GosoLogger and adds a method for retrieving a slice of log records. By default the logger used in env does not collect any records and returns an empty slice when requesting the recorded logs. Log Recording can be turned on through options on both the env and the suite. This is handled through adding an additional handler to the console logger which pushes logs to the recording logger's internal record map.