-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more tests to pass the test threshold
- Loading branch information
1 parent
ed791f1
commit 3225fe6
Showing
3 changed files
with
87 additions
and
0 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,26 @@ | ||
// Copyright (c) F5, Inc. | ||
// | ||
// This source code is licensed under the Apache License, Version 2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
package stub | ||
|
||
import ( | ||
"bytes" | ||
"log/slog" | ||
) | ||
|
||
// StubLoggerWith follows the pattern for replacing slog | ||
// with a handler that can take a buffer. The buffer gets filled | ||
// by adding log statements to as the code is executed. | ||
// You can see more information in the following video for context | ||
// https://www.youtube.com/watch?v=i1bDIyIaxbE | ||
|
||
func StubLoggerWith(buffer *bytes.Buffer) { | ||
mockLoggerHandler := slog.NewTextHandler(buffer, &slog.HandlerOptions{ | ||
Level: slog.LevelDebug, | ||
}) | ||
|
||
logger := slog.New(mockLoggerHandler) | ||
slog.SetDefault(logger) | ||
} |