mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-09 08:40:29 +00:00
test(logging): add logtest.NewLogger (#1300)
Return a `Logger` and its recording `Handler` together, so tests no longer need the two-line setup. Stacked on https://gitea.com/gitea/runner/pulls/1295. Assisted-by: Codet Co-authored-by: bircni <[email protected]> Reviewed-on: https://gitea.com/gitea/runner/pulls/1300 Reviewed-by: bircni <[email protected]>
This commit is contained in:
1 parent
de961b91eb
commit
3bc5cc03f8
7 files changed
+21
-32
No files matched your search
@@ -92,8 +92,7 @@ func frameOf(t *testing.T, pc uintptr) runtime.Frame {
|
||||
}
|
||||
|
||||
func TestCallerPC(t *testing.T) {
|
||||
h := logtest.New()
|
||||
l := logging.New(h)
|
||||
l, h := logtest.NewLogger()
|
||||
l.Infof("method")
|
||||
l.Info("method")
|
||||
for _, r := range h.AllRecords() {
|
||||
|
||||
Reference in new issue
Block a user