Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 146 for slug (0.1 sec)

  1. 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)
  2. 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)
  3. src/cmd/go/internal/modfetch/zip_sum_test/testdata/zip_sums.csv

    github.com/gorilla/websocket,v1.4.1,h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=,86eb427567de9e2dc84da52ee4f4315496c5ffc2152928df0e3ac4ce8a359ff7
    github.com/gosimple/slug,v1.9.0,h1:r5vDcYrFz9BmfIAMC829un9hq7hKM4cHUrsv36LbEqs=,0f72d897e3decea434cdc68c7d0226afbda7d6b1908e955bf406333e7d6bb4a7
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 18 17:29:01 UTC 2020
    - 334.9K bytes
    - Viewed (0)
  4. src/log/slog/example_log_level_test.go

    	currentLogLevel := slog.SetLogLoggerLevel(slog.LevelError)
    	defer slog.SetLogLoggerLevel(currentLogLevel) // revert changes after the example
    
    	defer slog.SetDefault(slog.Default()) // revert changes after the example
    	slog.SetDefault(slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{ReplaceAttr: slogtest.RemoveTime})))
    
    	log.Print("error") // level=ERROR msg=error
    
    	// Output:
    	// level=ERROR msg=error
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 10 21:25:30 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  5. src/testing/slogtest/slogtest.go

    			l.Info("msg", "a", "b", slog.Group("G", slog.String("c", "d")), "e", "f")
    		},
    		checks: []check{
    			hasAttr("a", "b"),
    			inGroup("G", hasAttr("c", "d")),
    			hasAttr("e", "f"),
    		},
    	},
    	{
    		name:        "empty-group",
    		explanation: withSource("a Handler should ignore an empty group"),
    		f: func(l *slog.Logger) {
    			l.Info("msg", "a", "b", slog.Group("G"), "e", "f")
    		},
    		checks: []check{
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 08 17:55:47 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  6. src/log/slog/example_level_handler_test.go

    // 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
    }
    
    // NewLevelHandler returns a LevelHandler with the given level.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  7. src/log/slog/internal/benchmarks/benchmarks_test.go

    							slog.Any("error", testError),
    							slog.String("string", testString),
    							slog.Int("status", testInt),
    							slog.Duration("duration", testDuration),
    							slog.Time("time", testTime),
    							slog.Any("error", testError),
    							slog.String("string", testString),
    							slog.Int("status", testInt),
    							slog.Duration("duration", testDuration),
    							slog.Time("time", testTime),
    							slog.Any("error", testError),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 4.5K bytes
    - Viewed (0)
  8. src/log/slog/internal/benchmarks/handlers.go

    	case slog.KindUint64:
    		*buf = strconv.AppendUint(*buf, v.Uint64(), 10)
    	case slog.KindFloat64:
    		*buf = strconv.AppendFloat(*buf, v.Float64(), 'g', -1, 64)
    	case slog.KindBool:
    		*buf = strconv.AppendBool(*buf, v.Bool())
    	case slog.KindDuration:
    		*buf = strconv.AppendInt(*buf, v.Duration().Nanoseconds(), 10)
    	case slog.KindTime:
    		h.appendTime(buf, v.Time())
    	case slog.KindAny:
    		a := v.Any()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 12 20:33:37 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  9. 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)
  10. src/log/slog/example_wrap_test.go

    	r := slog.NewRecord(time.Now(), slog.LevelInfo, fmt.Sprintf(format, args...), pcs[0])
    	_ = logger.Handler().Handle(context.Background(), r)
    }
    
    func Example_wrapping() {
    	replace := func(groups []string, a slog.Attr) slog.Attr {
    		// Remove time.
    		if a.Key == slog.TimeKey && len(groups) == 0 {
    			return slog.Attr{}
    		}
    		// Remove the directory from the source's filename.
    		if a.Key == slog.SourceKey {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 04 18:32:54 UTC 2023
    - 1.3K bytes
    - Viewed (0)
Back to top