package log
import "github.com/ydb-platform/ydb-go-sdk/v3/log"
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 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
- func FromString(l string) Level
- func LevelFromContext(ctx context.Context) Level
- func (l Level) BoldColor() string
- func (l Level) Color() string
- func (l Level) String() string
- type Logger
- type Mapper
- type Option
Constants ¶
Functions ¶
func Coordination ¶
Coordination makes trace.Coordination with logging events from details
func DatabaseSQL ¶
DatabaseSQL makes trace.DatabaseSQL with logging events from details
func Default ¶
func Discovery ¶
Discovery makes trace.Discovery with logging events from details
func Driver ¶
Driver makes trace.Driver with logging events from details
func NamesFromContext ¶
func Ratelimiter ¶
Ratelimiter returns trace.Ratelimiter with logging events from details
func Retry ¶
Retry returns trace.Retry with logging events from details
func Scheme ¶
Scheme returns trace.Scheme with logging events from details
func Scripting ¶
Scripting returns trace.Scripting with logging events from details
func Table ¶
Table makes trace.Table with logging events from details
func Topic ¶
Topic returns trace.Topic with logging events from details
func WithColoring ¶
func WithColoring() simpleLoggerOption
func WithLevel ¶
func WithLogQuery ¶
func WithLogQuery() logQueryOption
func WithMinLevel ¶
func WithMinLevel(level Level) simpleLoggerOption
func WithNames ¶
Types ¶
type Field ¶
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 Any ¶
Any constructs untyped Field.
func Bool ¶
Bool constructs Field with BoolType
func Duration ¶
Duration constructs Field with DurationType
func Error ¶
Error is the same as NamedError("error", value)
func Int ¶
Int constructs Field with IntType
func Int64 ¶
func NamedError ¶
NamedError constructs Field with ErrorType
func String ¶
String constructs Field with StringType
func Stringer ¶
Stringer constructs Field with StringerType. If value is nil, resulting Field will be of AnyType instead of StringerType.
func Strings ¶
Strings constructs Field with StringsType
func (Field) AnyValue ¶
func (f Field) AnyValue() interface{}
AnyValue is a value getter for fields with AnyType type
func (Field) BoolValue ¶
BoolValue is a value getter for fields with BoolType type
func (Field) DurationValue ¶
DurationValue is a value getter for fields with DurationType type
func (Field) ErrorValue ¶
ErrorValue is a value getter for fields with ErrorType type
func (Field) Int64Value ¶
Int64Value is a value getter for fields with Int64Type type
func (Field) IntValue ¶
IntValue is a value getter for fields with IntType type
func (Field) Key ¶
func (Field) String ¶
Returns default string representation of Field value. It should be used by adapters that don't support f.Type directly.
func (Field) StringValue ¶
StringValue is a value getter for fields with StringType type
func (Field) Stringer ¶
Stringer is a value getter for fields with StringerType type
func (Field) StringsValue ¶
StringsValue is a value getter for fields with StringsType type
func (Field) Type ¶
type FieldType ¶
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 )
func (FieldType) String ¶
type Level ¶
type Level int
func FromString ¶
func LevelFromContext ¶
func (Level) BoldColor ¶
func (Level) Color ¶
func (Level) String ¶
type Logger ¶
type Logger interface { // Log logs the message with specified options and fields. // Implementations must not in any way use slice of fields after Log returns. Log(ctx context.Context, msg string, fields ...Field) }
type Mapper ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Source Files ¶
context.go coordination.go discovery.go driver.go field.go join.go level.go logger.go options.go ratelimiter.go retry.go scheme.go scripting.go sql.go table.go topic.go
- Version
- v3.49.1
- Published
- Aug 3, 2023
- Platform
- windows/amd64
- Imports
- 16 packages
- Last checked
- 17 seconds ago –
Tools for package owners.