Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 469 for sloc (0.04 sec)

  1. 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)
  2. 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)
  3. src/log/slog/internal/benchmarks/benchmarks.go

    	testInt      = 32768
    	testDuration = 23 * time.Second
    	testError    = errors.New("fail")
    )
    
    var testAttrs = []slog.Attr{
    	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: Sat Mar 25 12:14:46 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/ssa/sccp_test.go

    			Valu("cmp", OpLess64, c.config.Types.Bool, 0, nil, "v1", "v2"),
    			If("cmp", "b2", "b3")),
    		Bloc("b2",
    			Valu("v3", OpConst64, c.config.Types.Int64, 3, nil),
    			Goto("b4")),
    		Bloc("b3",
    			Valu("v4", OpConst64, c.config.Types.Int64, 4, nil),
    			Goto("b4")),
    		Bloc("b4",
    			Valu("merge", OpPhi, c.config.Types.Int64, 0, nil, "v3", "v4"),
    			Exit("mem")))
    	sccp(fun.f)
    	CheckFunc(fun.f)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 12 21:01:50 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  5. src/runtime/mwbbuf.go

    // file deals only with the buffer.
    //
    // The write barrier has a fast path and a slow path. The fast path
    // simply enqueues to a per-P write barrier buffer. It's written in
    // assembly and doesn't clobber any general purpose registers, so it
    // doesn't have the usual overheads of a Go call.
    //
    // When the buffer fills up, the write barrier invokes the slow path
    // (wbBufFlush) to flush the buffer to the GC work queues. In this
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  6. src/log/internal/internal.go

    // license that can be found in the LICENSE file.
    
    // Package internal contains definitions used by both log and log/slog.
    package internal
    
    // DefaultOutput holds a function which calls the default log.Logger's
    // output function.
    // It allows slog.defaultHandler to call into an unexported function of
    // the log package.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 12 18:33:50 UTC 2023
    - 487 bytes
    - Viewed (0)
  7. 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)
  8. 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)
  9. src/cmd/compile/internal/ssa/fuse_test.go

    	//      z3
    	//       |
    	//     exit
    	fun := c.Fun("entry",
    		Bloc("entry",
    			Valu("mem", OpInitMem, types.TypeMem, 0, nil),
    			Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
    			Goto("z0")),
    		Bloc("z1",
    			Goto("z2")),
    		Bloc("z3",
    			Goto("exit")),
    		Bloc("z2",
    			Goto("z3")),
    		Bloc("z0",
    			Goto("z1")),
    		Bloc("exit",
    			Exit("mem"),
    		))
    
    	CheckFunc(fun.f)
    	fuseLate(fun.f)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 31 20:45:54 UTC 2023
    - 7.4K bytes
    - Viewed (0)
  10. 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)
Back to top