Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for LevelDebug (0.24 sec)

  1. src/log/slog/level_test.go

    		{LevelError + 2, "ERROR+2"},
    		{LevelError - 2, "WARN+2"},
    		{LevelWarn, "WARN"},
    		{LevelWarn - 1, "INFO+3"},
    		{LevelInfo, "INFO"},
    		{LevelInfo + 1, "INFO+1"},
    		{LevelInfo - 3, "DEBUG+1"},
    		{LevelDebug, "DEBUG"},
    		{LevelDebug - 2, "DEBUG-2"},
    	} {
    		got := test.in.String()
    		if got != test.want {
    			t.Errorf("%d: got %s, want %s", test.in, got, test.want)
    		}
    	}
    }
    
    func TestLevelVar(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 20 20:44:14 UTC 2024
    - 4K bytes
    - Viewed (0)
  2. src/log/slog/logger.go

    	l.logAttrs(ctx, level, msg, attrs...)
    }
    
    // Debug logs at [LevelDebug].
    func (l *Logger) Debug(msg string, args ...any) {
    	l.log(context.Background(), LevelDebug, msg, args...)
    }
    
    // DebugContext logs at [LevelDebug] with the given context.
    func (l *Logger) DebugContext(ctx context.Context, msg string, args ...any) {
    	l.log(ctx, LevelDebug, msg, args...)
    }
    
    // Info logs at [LevelInfo].
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 18:26:18 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  3. src/log/slog/example_log_level_test.go

    	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
    	slog.Debug("debug")    // DEBUG 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/level.go

    // 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
    )
    
    // String returns a name for the level.
    // If the level has a name, then that name
    // in uppercase is returned.
    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_test.go

    	var logBuf bytes.Buffer
    	log.SetOutput(&logBuf)
    	log.SetFlags(0)
    
    	for _, test := range []struct {
    		logLevel Level
    		logFn    func(string, ...any)
    		want     string
    	}{
    		{LevelDebug, Debug, "DEBUG a"},
    		{LevelDebug, Info, "INFO a"},
    		{LevelInfo, Debug, ""},
    		{LevelInfo, Info, "INFO a"},
    	} {
    		SetLogLoggerLevel(test.logLevel)
    		test.logFn("a")
    		checkLogOutput(t, logBuf.String(), test.want)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 10 21:25:30 UTC 2023
    - 19.5K bytes
    - Viewed (0)
  6. src/log/slog/value_test.go

    	}
    	_ = u
    	_ = f
    	_ = b
    	_ = s
    	_ = x
    	_ = tm
    }
    
    func TestAnyLevelAlloc(t *testing.T) {
    	// Because typical Levels are small integers,
    	// they are zero-alloc.
    	var a Value
    	x := LevelDebug + 100
    	wantAllocs(t, 0, func() { a = AnyValue(x) })
    	_ = a
    }
    
    func TestAnyValue(t *testing.T) {
    	for _, test := range []struct {
    		in   any
    		want Value
    	}{
    		{1, IntValue(1)},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:12:08 UTC 2024
    - 6.9K bytes
    - Viewed (0)
  7. src/log/slog/handler_test.go

    	for _, test := range []struct {
    		leveler Leveler
    		want    bool
    	}{
    		{nil, true},
    		{LevelWarn, false},
    		{&LevelVar{}, true}, // defaults to Info
    		{levelVar(LevelWarn), false},
    		{LevelDebug, true},
    		{levelVar(LevelDebug), true},
    	} {
    		h := &commonHandler{opts: HandlerOptions{Level: test.leveler}}
    		got := h.enabled(LevelInfo)
    		if got != test.want {
    			t.Errorf("%v: got %t, want %t", test.leveler, got, test.want)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 02 13:57:53 UTC 2023
    - 19.6K bytes
    - Viewed (0)
  8. src/log/slog/doc.go

    	h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})
    	slog.SetDefault(slog.New(h))
    
    Now the program can change its logging level with a single statement:
    
    	programLevel.Set(slog.LevelDebug)
    
    # Groups
    
    Attributes can be collected into groups.
    A group has a name that is used to qualify the names of its attributes.
    How this qualification is displayed depends on the handler.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 15 14:35:48 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"KindGroup", Const, 21},
    		{"KindInt64", Const, 21},
    		{"KindLogValuer", Const, 21},
    		{"KindString", Const, 21},
    		{"KindTime", Const, 21},
    		{"KindUint64", Const, 21},
    		{"Level", Type, 21},
    		{"LevelDebug", Const, 21},
    		{"LevelError", Const, 21},
    		{"LevelInfo", Const, 21},
    		{"LevelKey", Const, 21},
    		{"LevelVar", Type, 21},
    		{"LevelWarn", Const, 21},
    		{"Leveler", Type, 21},
    		{"Log", Func, 21},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top