Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for LevelError (0.2 sec)

  1. src/log/slog/level_test.go

    	"bytes"
    	"flag"
    	"strings"
    	"testing"
    )
    
    func TestLevelString(t *testing.T) {
    	for _, test := range []struct {
    		in   Level
    		want string
    	}{
    		{0, "INFO"},
    		{LevelError, "ERROR"},
    		{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"},
    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/level.go

    	}
    
    	switch {
    	case l < LevelInfo:
    		return str("DEBUG", l-LevelDebug)
    	case l < LevelWarn:
    		return str("INFO", l-LevelInfo)
    	case l < LevelError:
    		return str("WARN", l-LevelWarn)
    	default:
    		return str("ERROR", l-LevelError)
    	}
    }
    
    // MarshalJSON implements [encoding/json.Marshaler]
    // by quoting the output of [Level.String].
    func (l Level) MarshalJSON() ([]byte, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 30 17:34:43 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  3. src/log/slog/example_log_level_test.go

    // of the internal writer that uses the custom handler for log package after
    // calling slog.SetDefault.
    func ExampleSetLogLoggerLevel_slog() {
    	// Set the default logging level to slog.LevelError.
    	currentLogLevel := slog.SetLogLoggerLevel(slog.LevelError)
    	defer slog.SetLogLoggerLevel(currentLogLevel) // revert changes after the example
    
    	defer slog.SetDefault(slog.Default()) // revert changes after the example
    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/logger.go

    	l.log(ctx, LevelWarn, msg, args...)
    }
    
    // Error logs at [LevelError].
    func (l *Logger) Error(msg string, args ...any) {
    	l.log(context.Background(), LevelError, msg, args...)
    }
    
    // ErrorContext logs at [LevelError] with the given context.
    func (l *Logger) ErrorContext(ctx context.Context, msg string, args ...any) {
    	l.log(ctx, LevelError, msg, args...)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 18:26:18 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  5. src/log/slog/logger_test.go

    		wantLevel Level
    	}{
    		{l.DebugContext, LevelDebug},
    		{l.InfoContext, LevelInfo},
    		{l.WarnContext, LevelWarn},
    		{l.ErrorContext, LevelError},
    		{DebugContext, LevelDebug},
    		{InfoContext, LevelInfo},
    		{WarnContext, LevelWarn},
    		{ErrorContext, LevelError},
    	} {
    		h.clear()
    		ctx := context.WithValue(context.Background(), "L", test.wantLevel)
    
    		test.f(ctx, "msg")
    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/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"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},
    		{"LogAttrs", 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