- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for LevelVar (0.24 sec)
-
src/log/slog/level_test.go
} if g, w := lf, LevelWarn+3; g != w { t.Errorf("got %v, want %v", g, w) } } func TestLevelVarMarshalText(t *testing.T) { var v LevelVar v.Set(LevelWarn) data, err := v.MarshalText() if err != nil { t.Fatal(err) } var v2 LevelVar if err := v2.UnmarshalText(data); err != nil { t.Fatal(err) } if g, w := v2.Level(), LevelWarn; g != w { t.Errorf("got %s, want %s", g, w) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Feb 20 20:44:14 UTC 2024 - 4K bytes - Viewed (0) -
src/log/slog/level.go
func (l Level) Level() Level { return l } // A LevelVar is a [Level] variable, to allow a [Handler] level to change // dynamically. // It implements [Leveler] as well as a Set method, // and it is safe for use by multiple goroutines. // The zero LevelVar corresponds to [LevelInfo]. type LevelVar struct { val atomic.Int64 } // Level returns v's level. func (v *LevelVar) Level() Level { return Level(int(v.val.Load())) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 30 17:34:43 UTC 2023 - 5.6K bytes - Viewed (0) -
src/log/slog/doc.go
fixes the handler's minimum level throughout its lifetime. Setting it to a [LevelVar] allows the level to be varied dynamically. A LevelVar holds a Level and is safe to read or write from multiple goroutines. To vary the level dynamically for an entire program, first initialize a global LevelVar: var programLevel = new(slog.LevelVar) // Info by default Then use the LevelVar to construct a handler, and make it the default:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Feb 15 14:35:48 UTC 2024 - 12.3K bytes - Viewed (0) -
src/log/slog/handler_test.go
} func TestHandlerEnabled(t *testing.T) { levelVar := func(l Level) *LevelVar { var al LevelVar al.Set(l) return &al } 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}, } {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 02 13:57:53 UTC 2023 - 19.6K bytes - Viewed (0) -
api/go1.21.txt
pkg log/slog, method (*Level) UnmarshalText([]uint8) error #56345 pkg log/slog, method (*LevelVar) Level() Level #56345 pkg log/slog, method (*LevelVar) MarshalText() ([]uint8, error) #56345 pkg log/slog, method (*LevelVar) Set(Level) #56345 pkg log/slog, method (*LevelVar) String() string #56345 pkg log/slog, method (*LevelVar) UnmarshalText([]uint8) error #56345
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Aug 07 09:39:17 UTC 2023 - 25.6K bytes - Viewed (0) -
src/log/slog/logger.go
package slog import ( "context" "log" loginternal "log/internal" "log/slog/internal" "runtime" "sync/atomic" "time" ) var defaultLogger atomic.Pointer[Logger] var logLoggerLevel LevelVar // SetLogLoggerLevel controls the level for the bridge to the [log] package. // // Before [SetDefault] is called, slog top-level logging functions call the default [log.Logger].
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Jan 08 18:26:18 UTC 2024 - 10.2K bytes - Viewed (0) -
src/log/slog/handler.go
// The handler discards records with lower levels. // If Level is nil, the handler assumes LevelInfo. // The handler calls Level.Level for each record processed; // to adjust the minimum level dynamically, use a LevelVar. Level Leveler // ReplaceAttr is called to rewrite each non-group attribute before it is logged. // The attribute's value has been resolved (see [Value.Resolve]).
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Dec 05 18:18:13 UTC 2023 - 17.5K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go
{"(*JSONHandler).WithGroup", Method, 21}, {"(*Level).UnmarshalJSON", Method, 21}, {"(*Level).UnmarshalText", Method, 21}, {"(*LevelVar).Level", Method, 21}, {"(*LevelVar).MarshalText", Method, 21}, {"(*LevelVar).Set", Method, 21}, {"(*LevelVar).String", Method, 21}, {"(*LevelVar).UnmarshalText", Method, 21}, {"(*Logger).Debug", Method, 21}, {"(*Logger).DebugContext", Method, 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)