Documentation ¶
Index ¶
- Constants
- func Coordination(l Logger, d trace.Detailer, opts ...Option) (t trace.Coordination)
- func DatabaseSQL(l Logger, d trace.Detailer, opts ...Option) (t trace.DatabaseSQL)
- func Default(w io.Writer, opts ...simpleLoggerOption) *defaultLogger
- func Discovery(l Logger, d trace.Detailer, opts ...Option) (t trace.Discovery)
- func Driver(l Logger, d trace.Detailer, opts ...Option) (t trace.Driver)
- func NamesFromContext(ctx context.Context) []string
- func Query(l Logger, d trace.Detailer, opts ...Option) (t trace.Query)
- func Ratelimiter(l Logger, d trace.Detailer, opts ...Option) (t trace.Ratelimiter)
- func Retry(l Logger, d trace.Detailer, opts ...Option) (t trace.Retry)
- func Scheme(l Logger, d trace.Detailer, opts ...Option) (t trace.Scheme)
- func Scripting(l Logger, d trace.Detailer, opts ...Option) (t trace.Scripting)
- func Table(l Logger, d trace.Detailer, opts ...Option) (t trace.Table)
- func Topic(l Logger, d trace.Detailer, opts ...Option) (t trace.Topic)
- func WithColoring() simpleLoggerOption
- func WithLevel(ctx context.Context, lvl Level) context.Context
- func WithLogQuery() logQueryOption
- func WithMinLevel(level Level) simpleLoggerOption
- func WithNames(ctx context.Context, names ...string) context.Context
- type Field
- func Any(key string, value interface{}) Field
- func Bool(key string, value bool) Field
- func Duration(key string, value time.Duration) Field
- func Error(value error) Field
- func Int(k string, v int) Field
- func Int64(k string, v int64) Field
- func NamedError(key string, value error) Field
- func String(k, v string) Field
- func Stringer(key string, value fmt.Stringer) Field
- func Strings(key string, value []string) Field
- func (f Field) AnyValue() interface{}
- func (f Field) BoolValue() bool
- func (f Field) DurationValue() time.Duration
- func (f Field) ErrorValue() error
- func (f Field) Int64Value() int64
- func (f Field) IntValue() int
- func (f Field) Key() string
- func (f Field) String() string
- func (f Field) StringValue() string
- func (f Field) Stringer() fmt.Stringer
- func (f Field) StringsValue() []string
- func (f Field) Type() FieldType
- type FieldType
- type Level
- type Logger
- type Mapper
- type Option
Constants ¶
const ( TRACE = Level(iota) DEBUG INFO WARN ERROR FATAL QUIET )
Variables ¶
This section is empty.
Functions ¶
func Coordination ¶ added in v3.10.0
Coordination makes trace.Coordination with logging events from details
func DatabaseSQL ¶ added in v3.34.0
DatabaseSQL makes trace.DatabaseSQL with logging events from details
func NamesFromContext ¶ added in v3.46.0
func Ratelimiter ¶ added in v3.10.0
Ratelimiter returns trace.Ratelimiter with logging events from details
func Scripting ¶ added in v3.10.0
Scripting returns trace.Scripting with logging events from details
func WithColoring ¶ added in v3.46.0
func WithColoring() simpleLoggerOption
func WithLogQuery ¶ added in v3.35.0
func WithLogQuery() logQueryOption
func WithMinLevel ¶ added in v3.46.0
func WithMinLevel(level Level) simpleLoggerOption
Types ¶
type Field ¶ added in v3.46.0
type Field struct {
// contains filtered or unexported fields
}
Field represents typed log field (a key-value pair). Adapters should determine Field's type based on Type and use the corresponding getter method to retrieve the value:
switch f.Type() { case logs.IntType: var i int = f.Int() // handle int value case logs.StringType: var s string = f.String() // handle string value //... }
Getter methods must not be called on fields with wrong Type (e.g. calling String() on fields with Type != StringType). Field must not be initialized directly as a struct literal.
func NamedError ¶ added in v3.46.0
NamedError constructs Field with ErrorType
func Stringer ¶ added in v3.46.0
Stringer constructs Field with StringerType. If value is nil, resulting Field will be of AnyType instead of StringerType.
func (Field) AnyValue ¶ added in v3.46.0
func (f Field) AnyValue() interface{}
AnyValue is a value getter for fields with AnyType type
func (Field) DurationValue ¶ added in v3.46.0
DurationValue is a value getter for fields with DurationType type
func (Field) ErrorValue ¶ added in v3.46.0
ErrorValue is a value getter for fields with ErrorType type
func (Field) Int64Value ¶ added in v3.46.0
Int64Value is a value getter for fields with Int64Type type
func (Field) String ¶ added in v3.46.0
Returns default string representation of Field value. It should be used by adapters that don't support f.Type directly.
func (Field) StringValue ¶ added in v3.46.0
StringValue is a value getter for fields with StringType type
func (Field) Stringer ¶ added in v3.46.0
Stringer is a value getter for fields with StringerType type
func (Field) StringsValue ¶ added in v3.46.0
StringsValue is a value getter for fields with StringsType type
type FieldType ¶ added in v3.46.0
type FieldType int
FieldType indicates type info about the Field. This enum might be extended in future releases. Adapters that don't support some FieldType value should use Field.Fallback() for marshaling.
const ( // InvalidType indicates that Field was not initialized correctly. Adapters // should either ignore such field or issue an error. No value getters should // be called on field with such type. InvalidType FieldType = iota IntType Int64Type StringType BoolType DurationType // StringsType corresponds to []string StringsType ErrorType // AnyType indicates that the Field is untyped. Adapters should use // reflection-based approached to marshal this field. AnyType // StringerType corresponds to fmt.Stringer StringerType )
type Level ¶ added in v3.15.0
type Level int