func LazyHandler(h Handler) Handler {
	return FuncHandler(func(r *Record) error {
		// go through the values (odd indices) and reassign
		// the values of any lazy fn to the result of its execution
		hadErr := false
		for i := 1; i < len(r.Ctx); i += 2 {
			lz, ok := r.Ctx[i].(Lazy)
			if ok {
				v, err := evaluateLazy(lz)
				if err != nil {
					hadErr = true
					r.Ctx[i] = err
				} else {
					if cs, ok := v.(stack.Trace); ok {
						v = cs.TrimBelow(stack.Call(r.CallPC[0])).
							TrimRuntime()
					}
					r.Ctx[i] = v
				}
			}
		}

		if hadErr {
			r.Ctx = append(r.Ctx, errorKey, "bad lazy")
		}

		return h.Log(r)
	})
}
func LazyHandler(h Handler) Handler {
	return FuncHandler(func(r *Record) error {
		// go through the values (odd indices) and reassign
		// the values of any lazy fn to the result of its execution
		hadErr := false
		for i := 1; i < len(r.Ctx); i += 2 {
			lz, ok := r.Ctx[i].(Lazy)
			if ok {
				v, err := evaluateLazy(lz)
				if err != nil {
					hadErr = true
					r.Ctx[i] = err
				} else {
					if cs, ok := v.(stack.Trace); ok {
						v = cs.TrimBelow(stack.Call(r.CallPC[0])).
							TrimRuntime()
					}
					r.Ctx[i] = v
				}
			}
		}

		if hadErr {
			r.Ctx = append(r.Ctx, errorKey, "bad lazy")
		}

		return h.Log(r)
	})
}
func LazyHandler ( h Handler ) Handler { return FuncHandler ( func ( r * Record ) error { // go through the values (odd indices) and reassign // the values of any lazy fn to the result of its execution hadErr := false for i := 1 ; i < len ( r . Ctx ) ; i += 2 { lz , ok := r . Ctx [ i ] . ( Lazy ) if ok { v , err := evaluateLazy ( lz ) if err != nil { hadErr = true r . Ctx [ i ] = err } else { if cs , ok := v . ( stack . Trace ) ; ok { v = cs . TrimBelow ( stack . Call ( r . CallPC [ 0 ] ) ) . TrimRuntime ( ) } r . Ctx [ i ] = v } } } if hadErr { r . Ctx = append ( r . Ctx , errorKey , " " ) } return h . Log ( r ) } ) }
// LazyHandler writes all values to the wrapped handler after evaluating
// any lazy functions in the record's context. It is already wrapped
// around StreamHandler and SyslogHandler in this library, you'll only need
// it if you write your own Handler.
LazyHandler writes all values to the wrapped handler after evaluating any lazy functions in the record s context . It is already wrapped around StreamHandler and SyslogHandler in this library you ll only need it if you write your own Handler .