Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for SlogTest (0.17 sec)

  1. src/log/slog/internal/slogtest/slogtest.go

    // Copyright 2022 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package slogtest contains support functions for testing slog.
    package slogtest
    
    import "log/slog"
    
    // RemoveTime removes the top-level time attribute.
    // It is intended to be used as a ReplaceAttr function,
    // to make example output deterministic.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 12 20:33:11 UTC 2023
    - 553 bytes
    - Viewed (0)
  2. src/testing/slogtest/slogtest.go

    // Copyright 2023 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package slogtest implements support for testing implementations of log/slog.Handler.
    package slogtest
    
    import (
    	"context"
    	"errors"
    	"fmt"
    	"log/slog"
    	"reflect"
    	"runtime"
    	"testing"
    	"time"
    )
    
    type testCase struct {
    	// Subtest name.
    	name string
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 08 17:55:47 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  3. src/testing/slogtest/example_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package slogtest_test
    
    import (
    	"bytes"
    	"encoding/json"
    	"log"
    	"log/slog"
    	"testing/slogtest"
    )
    
    // This example demonstrates one technique for testing a handler with this
    // package. The handler is given a [bytes.Buffer] to write to, and each line
    // of the resulting output is parsed.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  4. src/log/slog/example_logvaluer_secret_test.go

    // Copyright 2022 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package slog_test
    
    import (
    	"log/slog"
    	"log/slog/internal/slogtest"
    	"os"
    )
    
    // A token is a secret value that grants permissions.
    type Token string
    
    // LogValue implements slog.LogValuer.
    // It avoids revealing the token.
    func (Token) LogValue() slog.Value {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 906 bytes
    - Viewed (0)
  5. src/testing/slogtest/run_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package slogtest_test
    
    import (
    	"bytes"
    	"encoding/json"
    	"log/slog"
    	"testing"
    	"testing/slogtest"
    )
    
    func TestRun(t *testing.T) {
    	var buf bytes.Buffer
    
    	newHandler := func(*testing.T) slog.Handler {
    		buf.Reset()
    		return slog.NewJSONHandler(&buf, nil)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 20:37:12 UTC 2023
    - 623 bytes
    - Viewed (0)
  6. src/log/slog/slogtest_test.go

    // license that can be found in the LICENSE file.
    
    package slog_test
    
    import (
    	"bytes"
    	"encoding/json"
    	"fmt"
    	"io"
    	"log/slog"
    	"strings"
    	"testing"
    	"testing/slogtest"
    )
    
    func TestSlogtest(t *testing.T) {
    	for _, test := range []struct {
    		name  string
    		new   func(io.Writer) slog.Handler
    		parse func([]byte) (map[string]any, error)
    	}{
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 10 12:50:22 UTC 2023
    - 2.6K bytes
    - Viewed (0)
  7. src/log/slog/example_log_level_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package slog_test
    
    import (
    	"log"
    	"log/slog"
    	"log/slog/internal/slogtest"
    	"os"
    )
    
    // This example shows how to use slog.SetLogLoggerLevel to change the minimal level
    // of the internal default handler for slog package before calling slog.SetDefault.
    func ExampleSetLogLoggerLevel_log() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 10 21:25:30 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  8. src/log/slog/example_level_handler_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package slog_test
    
    import (
    	"context"
    	"log/slog"
    	"log/slog/internal/slogtest"
    	"os"
    )
    
    // A LevelHandler wraps a Handler with an Enabled method
    // that returns false for levels below a minimum.
    type LevelHandler struct {
    	level   slog.Leveler
    	handler slog.Handler
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  9. src/cmd/vet/testdata/slog/slog.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // This file contains tests for the slog checker.
    
    package slog
    
    import "log/slog"
    
    func SlogTest() {
    	slog.Info("msg", "a") // ERROR "call to slog.Info missing a final value"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 22 18:11:19 UTC 2023
    - 338 bytes
    - Viewed (0)
  10. src/go/build/deps_test.go

    	RUNTIME
    	< log/slog/internal, log/slog/internal/buffer;
    
    	FMT,
    	encoding, encoding/json,
    	log, log/internal,
    	log/slog/internal, log/slog/internal/buffer,
    	slices
    	< log/slog
    	< log/slog/internal/slogtest, log/slog/internal/benchmarks;
    
    	NET, log
    	< net/mail;
    
    	NONE < crypto/internal/boring/sig, crypto/internal/boring/syso;
    	sync/atomic < crypto/internal/boring/bcache, crypto/internal/boring/fipstls;
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 16:41:13 UTC 2024
    - 19.2K bytes
    - Viewed (0)
Back to top