Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for AddAttrs (0.09 sec)

  1. src/log/slog/record_test.go

    	r1 := NewRecord(time.Time{}, 0, "", 0)
    	r1.AddAttrs(intAttrs(0, nAttrsInline+1)...)
    	// Ensure that r1.back's capacity exceeds its length.
    	b := make([]Attr, len(r1.back), len(r1.back)+1)
    	copy(b, r1.back)
    	r1.back = b
    	// Make a copy that shares state.
    	r2 := r1
    	// Adding to both should insert a special Attr in the second.
    	r1AttrsBefore := attrsSlice(r1)
    	r1.AddAttrs(Int("p", 0))
    	r2.AddAttrs(Int("p", 1))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 15:10:55 UTC 2023
    - 4K bytes
    - Viewed (0)
  2. src/log/slog/text_handler_test.go

    	testenv.SkipIfOptimizationOff(t)
    	r := NewRecord(time.Now(), LevelInfo, "msg", 0)
    	for i := 0; i < 10; i++ {
    		r.AddAttrs(Int("x = y", i))
    	}
    	var h Handler = NewTextHandler(io.Discard, nil)
    	wantAllocs(t, 0, func() { h.Handle(context.Background(), r) })
    
    	h = h.WithGroup("s")
    	r.AddAttrs(Group("g", Int("a", 1)))
    	wantAllocs(t, 0, func() { h.Handle(context.Background(), r) })
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 22 19:05:59 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  3. src/log/slog/record.go

    	for i := 0; i < r.nFront; i++ {
    		if !f(r.front[i]) {
    			return
    		}
    	}
    	for _, a := range r.back {
    		if !f(a) {
    			return
    		}
    	}
    }
    
    // AddAttrs appends the given Attrs to the [Record]'s list of Attrs.
    // It omits empty groups.
    func (r *Record) AddAttrs(attrs ...Attr) {
    	var i int
    	for i = 0; i < len(attrs) && r.nFront < len(r.front); i++ {
    		a := attrs[i]
    		if a.Value.isEmptyGroup() {
    			continue
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 08 16:30:56 UTC 2023
    - 6K bytes
    - Viewed (0)
  4. src/log/slog/internal/benchmarks/handlers_test.go

    import (
    	"bytes"
    	"context"
    	"log/slog"
    	"slices"
    	"testing"
    )
    
    func TestHandlers(t *testing.T) {
    	ctx := context.Background()
    	r := slog.NewRecord(testTime, slog.LevelInfo, testMessage, 0)
    	r.AddAttrs(testAttrs...)
    	t.Run("text", func(t *testing.T) {
    		var b bytes.Buffer
    		h := newFastTextHandler(&b)
    		if err := h.Handle(ctx, r); err != nil {
    			t.Fatal(err)
    		}
    		got := b.String()
    		if got != wantText {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 17 23:34:11 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  5. src/log/slog/handler_test.go

    			var wg sync.WaitGroup
    			for i := 0; i < count; i++ {
    				sub1Record := NewRecord(time.Time{}, LevelInfo, "hello from sub1", 0)
    				sub1Record.AddAttrs(Int("i", i))
    				sub2Record := NewRecord(time.Time{}, LevelInfo, "hello from sub2", 0)
    				sub2Record.AddAttrs(Int("i", i))
    				wg.Add(1)
    				go func() {
    					defer wg.Done()
    					if err := sub1.Handle(ctx, sub1Record); err != nil {
    						t.Error(err)
    					}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 02 13:57:53 UTC 2023
    - 19.6K bytes
    - Viewed (0)
  6. tensorflow/c/eager/immediate_execution_operation.h

      // Set stack trace to be used for potential async error reporting.
      virtual void SetStackTrace(ManagedStackTrace stack_trace) = 0;
    
      virtual const tensorflow::AbstractOpAttrs* GetOpAttrs() const = 0;
      virtual void AddAttrs(const AbstractOpAttrs* op_attrs) = 0;
    
      virtual void SetCancellationManager(
          CancellationManager* cancellation_manager) = 0;
    
      // Returns the stack trace set by `SetStackTrace` if exists.
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Mon Sep 26 22:40:32 UTC 2022
    - 3.6K bytes
    - Viewed (0)
  7. tensorflow/compiler/mlir/lite/experimental/tac/transforms/raise_target_subgraphs.cc

          int& func_count, const TF::SideEffectAnalysis::Info& side_effect_info);
    };
    
    // After raising ops and adding the Func & Call op, call this function
    // to set attributes specific to this pass.
    void AddAttrs(OpsAdded& ops_added, OpBuilder& builder, int func_count) {
      func::FuncOp& added_func_op = ops_added.func_op;
      func::CallOp& added_call_op = ops_added.call_op;
      StringAttr interface_name =
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 11.4K bytes
    - Viewed (0)
  8. src/log/slog/json_handler_test.go

    		},
    	} {
    		t.Run(test.name, func(t *testing.T) {
    			var buf bytes.Buffer
    			h := NewJSONHandler(&buf, &test.opts)
    			r := NewRecord(testTime, LevelInfo, "m", 0)
    			r.AddAttrs(Int("a", 1), Any("m", map[string]int{"b": 2}))
    			if err := h.Handle(context.Background(), r); err != nil {
    				t.Fatal(err)
    			}
    			got := strings.TrimSuffix(buf.String(), "\n")
    			if got != test.want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jul 11 17:06:26 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  9. src/log/slog/logger.go

    	if !internal.IgnorePC {
    		var pcs [1]uintptr
    		// skip [runtime.Callers, this function, this function's caller]
    		runtime.Callers(3, pcs[:])
    		pc = pcs[0]
    	}
    	r := NewRecord(time.Now(), level, msg, pc)
    	r.AddAttrs(attrs...)
    	if ctx == nil {
    		ctx = context.Background()
    	}
    	_ = l.Handler().Handle(ctx, r)
    }
    
    // Debug calls [Logger.Debug] on the default logger.
    func Debug(msg string, args ...any) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 18:26:18 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  10. src/log/slog/doc.go

    and hidden fields that refer to state (such as attributes) indirectly. This
    means that modifying a simple copy of a Record (e.g. by calling
    [Record.Add] or [Record.AddAttrs] to add attributes)
    may have unexpected effects on the original.
    Before modifying a Record, use [Record.Clone] to
    create a copy that shares no state with the original,
    or create a new Record with [NewRecord]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 15 14:35:48 UTC 2024
    - 12.3K bytes
    - Viewed (0)
Back to top