File: go1_21_log_slog.go

package info (click to toggle)
golang-github-traefik-yaegi 0.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 24,608 kB
  • sloc: sh: 457; makefile: 39
file content (139 lines) | stat: -rw-r--r-- 5,675 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Code generated by 'yaegi extract log/slog'. DO NOT EDIT.

//go:build go1.21 && !go1.22
// +build go1.21,!go1.22

package stdlib

import (
	"context"
	"go/constant"
	"go/token"
	"log/slog"
	"reflect"
)

func init() {
	Symbols["log/slog/slog"] = map[string]reflect.Value{
		// function, constant and variable definitions
		"Any":            reflect.ValueOf(slog.Any),
		"AnyValue":       reflect.ValueOf(slog.AnyValue),
		"Bool":           reflect.ValueOf(slog.Bool),
		"BoolValue":      reflect.ValueOf(slog.BoolValue),
		"Debug":          reflect.ValueOf(slog.Debug),
		"DebugContext":   reflect.ValueOf(slog.DebugContext),
		"Default":        reflect.ValueOf(slog.Default),
		"Duration":       reflect.ValueOf(slog.Duration),
		"DurationValue":  reflect.ValueOf(slog.DurationValue),
		"Error":          reflect.ValueOf(slog.Error),
		"ErrorContext":   reflect.ValueOf(slog.ErrorContext),
		"Float64":        reflect.ValueOf(slog.Float64),
		"Float64Value":   reflect.ValueOf(slog.Float64Value),
		"Group":          reflect.ValueOf(slog.Group),
		"GroupValue":     reflect.ValueOf(slog.GroupValue),
		"Info":           reflect.ValueOf(slog.Info),
		"InfoContext":    reflect.ValueOf(slog.InfoContext),
		"Int":            reflect.ValueOf(slog.Int),
		"Int64":          reflect.ValueOf(slog.Int64),
		"Int64Value":     reflect.ValueOf(slog.Int64Value),
		"IntValue":       reflect.ValueOf(slog.IntValue),
		"KindAny":        reflect.ValueOf(slog.KindAny),
		"KindBool":       reflect.ValueOf(slog.KindBool),
		"KindDuration":   reflect.ValueOf(slog.KindDuration),
		"KindFloat64":    reflect.ValueOf(slog.KindFloat64),
		"KindGroup":      reflect.ValueOf(slog.KindGroup),
		"KindInt64":      reflect.ValueOf(slog.KindInt64),
		"KindLogValuer":  reflect.ValueOf(slog.KindLogValuer),
		"KindString":     reflect.ValueOf(slog.KindString),
		"KindTime":       reflect.ValueOf(slog.KindTime),
		"KindUint64":     reflect.ValueOf(slog.KindUint64),
		"LevelDebug":     reflect.ValueOf(slog.LevelDebug),
		"LevelError":     reflect.ValueOf(slog.LevelError),
		"LevelInfo":      reflect.ValueOf(slog.LevelInfo),
		"LevelKey":       reflect.ValueOf(constant.MakeFromLiteral("\"level\"", token.STRING, 0)),
		"LevelWarn":      reflect.ValueOf(slog.LevelWarn),
		"Log":            reflect.ValueOf(slog.Log),
		"LogAttrs":       reflect.ValueOf(slog.LogAttrs),
		"MessageKey":     reflect.ValueOf(constant.MakeFromLiteral("\"msg\"", token.STRING, 0)),
		"New":            reflect.ValueOf(slog.New),
		"NewJSONHandler": reflect.ValueOf(slog.NewJSONHandler),
		"NewLogLogger":   reflect.ValueOf(slog.NewLogLogger),
		"NewRecord":      reflect.ValueOf(slog.NewRecord),
		"NewTextHandler": reflect.ValueOf(slog.NewTextHandler),
		"SetDefault":     reflect.ValueOf(slog.SetDefault),
		"SourceKey":      reflect.ValueOf(constant.MakeFromLiteral("\"source\"", token.STRING, 0)),
		"String":         reflect.ValueOf(slog.String),
		"StringValue":    reflect.ValueOf(slog.StringValue),
		"Time":           reflect.ValueOf(slog.Time),
		"TimeKey":        reflect.ValueOf(constant.MakeFromLiteral("\"time\"", token.STRING, 0)),
		"TimeValue":      reflect.ValueOf(slog.TimeValue),
		"Uint64":         reflect.ValueOf(slog.Uint64),
		"Uint64Value":    reflect.ValueOf(slog.Uint64Value),
		"Warn":           reflect.ValueOf(slog.Warn),
		"WarnContext":    reflect.ValueOf(slog.WarnContext),
		"With":           reflect.ValueOf(slog.With),

		// type definitions
		"Attr":           reflect.ValueOf((*slog.Attr)(nil)),
		"Handler":        reflect.ValueOf((*slog.Handler)(nil)),
		"HandlerOptions": reflect.ValueOf((*slog.HandlerOptions)(nil)),
		"JSONHandler":    reflect.ValueOf((*slog.JSONHandler)(nil)),
		"Kind":           reflect.ValueOf((*slog.Kind)(nil)),
		"Level":          reflect.ValueOf((*slog.Level)(nil)),
		"LevelVar":       reflect.ValueOf((*slog.LevelVar)(nil)),
		"Leveler":        reflect.ValueOf((*slog.Leveler)(nil)),
		"LogValuer":      reflect.ValueOf((*slog.LogValuer)(nil)),
		"Logger":         reflect.ValueOf((*slog.Logger)(nil)),
		"Record":         reflect.ValueOf((*slog.Record)(nil)),
		"Source":         reflect.ValueOf((*slog.Source)(nil)),
		"TextHandler":    reflect.ValueOf((*slog.TextHandler)(nil)),
		"Value":          reflect.ValueOf((*slog.Value)(nil)),

		// interface wrapper definitions
		"_Handler":   reflect.ValueOf((*_log_slog_Handler)(nil)),
		"_Leveler":   reflect.ValueOf((*_log_slog_Leveler)(nil)),
		"_LogValuer": reflect.ValueOf((*_log_slog_LogValuer)(nil)),
	}
}

// _log_slog_Handler is an interface wrapper for Handler type
type _log_slog_Handler struct {
	IValue     interface{}
	WEnabled   func(a0 context.Context, a1 slog.Level) bool
	WHandle    func(a0 context.Context, a1 slog.Record) error
	WWithAttrs func(attrs []slog.Attr) slog.Handler
	WWithGroup func(name string) slog.Handler
}

func (W _log_slog_Handler) Enabled(a0 context.Context, a1 slog.Level) bool {
	return W.WEnabled(a0, a1)
}
func (W _log_slog_Handler) Handle(a0 context.Context, a1 slog.Record) error {
	return W.WHandle(a0, a1)
}
func (W _log_slog_Handler) WithAttrs(attrs []slog.Attr) slog.Handler {
	return W.WWithAttrs(attrs)
}
func (W _log_slog_Handler) WithGroup(name string) slog.Handler {
	return W.WWithGroup(name)
}

// _log_slog_Leveler is an interface wrapper for Leveler type
type _log_slog_Leveler struct {
	IValue interface{}
	WLevel func() slog.Level
}

func (W _log_slog_Leveler) Level() slog.Level {
	return W.WLevel()
}

// _log_slog_LogValuer is an interface wrapper for LogValuer type
type _log_slog_LogValuer struct {
	IValue    interface{}
	WLogValue func() slog.Value
}

func (W _log_slog_LogValuer) LogValue() slog.Value {
	return W.WLogValue()
}