Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,192 for slog (0.04 sec)

  1. 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)
  2. src/testing/slogtest/run_test.go

    // 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)
    	}
    	result := func(t *testing.T) map[string]any {
    		m := map[string]any{}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 20:37:12 UTC 2023
    - 623 bytes
    - Viewed (0)
  3. src/log/slog/json_handler_test.go

    				String("program", "my-test-program"),
    				String("package", "log/slog"),
    				String("traceID", "2039232309232309"),
    				String("URL", "https://pkg.go.dev/golang.org/x/log/slog"))
    			b.ReportAllocs()
    			b.ResetTimer()
    			for i := 0; i < b.N; i++ {
    				l.LogAttrs(ctx, LevelInfo, "this is a typical log message",
    					String("module", "github.com/google/go-cmp"),
    					String("version", "v1.23.4"),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jul 11 17:06:26 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  4. src/log/slog/level.go

    // OpenTelemetry's mapping. Subtracting 9 from an OpenTelemetry level in the
    // DEBUG, INFO, WARN and ERROR ranges converts it to the corresponding slog
    // Level range. OpenTelemetry also has the names TRACE and FATAL, which slog
    // does not. But those OpenTelemetry levels can still be represented as slog
    // Levels by using the appropriate integers.
    const (
    	LevelDebug Level = -4
    	LevelInfo  Level = 0
    	LevelWarn  Level = 4
    	LevelError Level = 8
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 30 17:34:43 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  5. src/log/slog/logger.go

    package slog
    
    import (
    	"context"
    	"log"
    	loginternal "log/internal"
    	"log/slog/internal"
    	"runtime"
    	"sync/atomic"
    	"time"
    )
    
    var defaultLogger atomic.Pointer[Logger]
    
    var logLoggerLevel LevelVar
    
    // SetLogLoggerLevel controls the level for the bridge to the [log] package.
    //
    // Before [SetDefault] is called, slog top-level logging functions call the default [log.Logger].
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 18:26:18 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  6. src/go/build/deps_test.go

    	FMT, log/internal
    	< log;
    
    	log, log/slog !< crypto/tls, database/sql, go/importer, testing;
    
    	FMT, log, net
    	< log/syslog;
    
    	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;
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 16:41:13 UTC 2024
    - 19.2K bytes
    - Viewed (0)
  7. src/log/slog/handler.go

    	//
    	// A Handler should treat WithGroup as starting a Group of Attrs that ends
    	// at the end of the log event. That is,
    	//
    	//     logger.WithGroup("s").LogAttrs(ctx, level, msg, slog.Int("a", 1), slog.Int("b", 2))
    	//
    	// should behave like
    	//
    	//     logger.LogAttrs(ctx, level, msg, slog.Group("s", slog.Int("a", 1), slog.Int("b", 2)))
    	//
    	// If the name is empty, WithGroup returns the receiver.
    	WithGroup(name string) Handler
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 05 18:18:13 UTC 2023
    - 17.5K bytes
    - Viewed (0)
  8. src/log/slog/logger_test.go

    	currentLogger := Default()
    	currentLogWriter := log.Writer()
    	currentLogFlags := log.Flags()
    	SetDefault(New(newDefaultHandler(loginternal.DefaultOutput)))
    	t.Cleanup(func() {
    		SetDefault(currentLogger)
    		log.SetOutput(currentLogWriter)
    		log.SetFlags(currentLogFlags)
    	})
    
    	// The default slog.Logger's handler uses the log package's default output.
    	log.SetOutput(&logbuf)
    	log.SetFlags(log.Lshortfile &^ log.LstdFlags)
    	Info("msg", "a", 1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 10 21:25:30 UTC 2023
    - 19.5K bytes
    - Viewed (0)
  9. src/cmd/vet/main.go

    	"golang.org/x/tools/go/analysis/passes/printf"
    	"golang.org/x/tools/go/analysis/passes/shift"
    	"golang.org/x/tools/go/analysis/passes/sigchanyzer"
    	"golang.org/x/tools/go/analysis/passes/slog"
    	"golang.org/x/tools/go/analysis/passes/stdmethods"
    	"golang.org/x/tools/go/analysis/passes/stdversion"
    	"golang.org/x/tools/go/analysis/passes/stringintconv"
    	"golang.org/x/tools/go/analysis/passes/structtag"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 19:41:17 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  10. src/log/slog/record_test.go

    	for _, test := range []struct {
    		depth            int
    		wantFunction     string
    		wantFile         string
    		wantLinePositive bool
    	}{
    		{0, "", "", false},
    		{-16, "", "", false},
    		{1, "log/slog.TestRecordSource", "record_test.go", true}, // 1: caller of NewRecord
    		{2, "testing.tRunner", "testing.go", true},
    	} {
    		var pc uintptr
    		if test.depth > 0 {
    			pc = callerPC(test.depth + 1)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 15:10:55 UTC 2023
    - 4K bytes
    - Viewed (0)
Back to top