Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 282 for slog (0.04 sec)

  1. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/slog/slog.go

    		}
    	})
    	return nil, nil
    }
    
    func isAttr(t types.Type) bool {
    	return analysisutil.IsNamedType(t, "log/slog", "Attr")
    }
    
    // shortName returns a name for the function that is shorter than FullName.
    // Examples:
    //
    //	"slog.Info" (instead of "log/slog.Info")
    //	"slog.Logger.With" (instead of "(*log/slog.Logger).With")
    func shortName(fn *types.Func) string {
    	var r string
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  2. src/log/slog/example_test.go

    package slog_test
    
    import (
    	"log/slog"
    	"net/http"
    	"os"
    	"time"
    )
    
    func ExampleGroup() {
    	r, _ := http.NewRequest("GET", "localhost", nil)
    	// ...
    
    	logger := slog.New(
    		slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
    			ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
    				if a.Key == slog.TimeKey && len(groups) == 0 {
    					return slog.Attr{}
    				}
    				return a
    			},
    		}),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 17 14:56:30 UTC 2023
    - 857 bytes
    - Viewed (0)
  3. src/log/slog/example_log_level_test.go

    	log.SetOutput(os.Stdout)
    
    	// Default logging level is slog.LevelInfo.
    	log.Print("log debug") // log debug
    	slog.Debug("debug")    // no output
    	slog.Info("info")      // INFO info
    
    	// Set the default logging level to slog.LevelDebug.
    	currentLogLevel := slog.SetLogLoggerLevel(slog.LevelDebug)
    	defer slog.SetLogLoggerLevel(currentLogLevel) // revert changes after the example
    
    	log.Print("log debug") // log debug
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 10 21:25:30 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  4. src/log/slog/internal/benchmarks/handlers_test.go

    			t.Fatal(err)
    		}
    		got := h.ringBuffer[0]
    		if !got.Time.Equal(r.Time) || !slices.EqualFunc(attrSlice(got), attrSlice(r), slog.Attr.Equal) {
    			t.Errorf("got %+v, want %+v", got, r)
    		}
    	})
    }
    
    func attrSlice(r slog.Record) []slog.Attr {
    	var as []slog.Attr
    	r.Attrs(func(a slog.Attr) bool { as = append(as, a); return true })
    	return as
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 17 23:34:11 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  5. 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)
  6. 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)
  7. 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)
  8. src/cmd/go/internal/test/flagdefs.go

    	"lostcancel":       true,
    	"methods":          true,
    	"nilfunc":          true,
    	"printf":           true,
    	"rangeloops":       true,
    	"shift":            true,
    	"sigchanyzer":      true,
    	"slog":             true,
    	"stdmethods":       true,
    	"stdversion":       true,
    	"stringintconv":    true,
    	"structtag":        true,
    	"testinggoroutine": true,
    	"tests":            true,
    	"timeformat":       true,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 01:02:40 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  9. src/log/slog/attr_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
    
    import (
    	"internal/testenv"
    	"testing"
    	"time"
    )
    
    func TestAttrNoAlloc(t *testing.T) {
    	testenv.SkipIfOptimizationOff(t)
    	// Assign values just to make sure the compiler doesn't optimize away the statements.
    	var (
    		i int64
    		u uint64
    		f float64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 18:23:25 UTC 2024
    - 1.4K bytes
    - Viewed (0)
  10. src/log/slog/json_handler.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
    
    import (
    	"bytes"
    	"context"
    	"encoding/json"
    	"errors"
    	"fmt"
    	"io"
    	"log/slog/internal/buffer"
    	"strconv"
    	"sync"
    	"time"
    	"unicode/utf8"
    )
    
    // JSONHandler is a [Handler] that writes Records to an [io.Writer] as
    // line-delimited JSON objects.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 17 16:18:11 UTC 2023
    - 8.1K bytes
    - Viewed (0)
Back to top