Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for LevelVar (0.36 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
Back to top