|
| 1 | +// Copyright The OpenTelemetry Authors |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +package otelzap // import "go.opentelemetry.io/contrib/bridges/otelzap" |
| 5 | + |
| 6 | +import ( |
| 7 | + "time" |
| 8 | + |
| 9 | + "go.uber.org/zap/zapcore" |
| 10 | + |
| 11 | + "go.opentelemetry.io/otel/log" |
| 12 | +) |
| 13 | + |
| 14 | +var _ zapcore.ObjectEncoder = (*objectEncoder)(nil) |
| 15 | + |
| 16 | +// objectEncoder implements zapcore.ObjectEncoder. |
| 17 | +// It encodes given fields to OTel key-values. |
| 18 | +type objectEncoder struct { |
| 19 | + kv []log.KeyValue // nolint:unused |
| 20 | +} |
| 21 | + |
| 22 | +// nolint:unused |
| 23 | +func newObjectEncoder(len int) *objectEncoder { |
| 24 | + keyval := make([]log.KeyValue, 0, len) |
| 25 | + |
| 26 | + return &objectEncoder{ |
| 27 | + kv: keyval, |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +// AddArray converts array to log.Slice using ArrayEncoder. |
| 32 | +func (m *objectEncoder) AddArray(key string, v zapcore.ArrayMarshaler) error { |
| 33 | + // TODO |
| 34 | + return nil |
| 35 | +} |
| 36 | + |
| 37 | +// AddObject converts object to log.Map using ObjectEncoder. |
| 38 | +func (m *objectEncoder) AddObject(k string, v zapcore.ObjectMarshaler) error { |
| 39 | + // TODO |
| 40 | + return nil |
| 41 | +} |
| 42 | + |
| 43 | +// AddBinary converts binary to log.Bytes. |
| 44 | +func (m *objectEncoder) AddBinary(k string, v []byte) { |
| 45 | + // TODO |
| 46 | +} |
| 47 | + |
| 48 | +// AddByteString converts byte to log.String. |
| 49 | +func (m *objectEncoder) AddByteString(k string, v []byte) { |
| 50 | + // TODO |
| 51 | +} |
| 52 | + |
| 53 | +// AddBool converts bool to log.Bool. |
| 54 | +func (m *objectEncoder) AddBool(k string, v bool) { |
| 55 | + // TODO |
| 56 | +} |
| 57 | + |
| 58 | +// AddDuration converts duration to log.Int. |
| 59 | +func (m *objectEncoder) AddDuration(k string, v time.Duration) { |
| 60 | + // TODO |
| 61 | +} |
| 62 | + |
| 63 | +// TODO. |
| 64 | +func (m *objectEncoder) AddComplex128(k string, v complex128) { |
| 65 | +} |
| 66 | + |
| 67 | +// AddFloat64 converts float64 to log.Float64. |
| 68 | +func (m *objectEncoder) AddFloat64(k string, v float64) { |
| 69 | + // TODO |
| 70 | +} |
| 71 | + |
| 72 | +// AddFloat32 converts float32 to log.Float64. |
| 73 | +func (m *objectEncoder) AddFloat32(k string, v float32) { |
| 74 | + // TODO |
| 75 | +} |
| 76 | + |
| 77 | +// AddInt64 converts int64 to log.Int64. |
| 78 | +func (m *objectEncoder) AddInt64(k string, v int64) { |
| 79 | + // TODO |
| 80 | +} |
| 81 | + |
| 82 | +// AddInt converts int to log.Int. |
| 83 | +func (m *objectEncoder) AddInt(k string, v int) { |
| 84 | + // TODO |
| 85 | +} |
| 86 | + |
| 87 | +// AddString converts string to log.String. |
| 88 | +func (m *objectEncoder) AddString(k string, v string) { |
| 89 | + // TODO |
| 90 | +} |
| 91 | + |
| 92 | +// TODO. |
| 93 | +func (m *objectEncoder) AddUint64(k string, v uint64) { |
| 94 | +} |
| 95 | + |
| 96 | +// TODO. |
| 97 | +func (m *objectEncoder) AddReflected(k string, v interface{}) error { |
| 98 | + return nil |
| 99 | +} |
| 100 | + |
| 101 | +// OpenNamespace opens an isolated namespace where all subsequent fields will |
| 102 | +// be added. |
| 103 | +func (m *objectEncoder) OpenNamespace(k string) { |
| 104 | + // TODO |
| 105 | +} |
| 106 | + |
| 107 | +// TODO. |
| 108 | +func (m *objectEncoder) AddComplex64(k string, v complex64) {} |
| 109 | +func (m *objectEncoder) AddInt32(k string, v int32) {} |
| 110 | +func (m *objectEncoder) AddInt16(k string, v int16) {} |
| 111 | +func (m *objectEncoder) AddInt8(k string, v int8) {} |
| 112 | +func (m *objectEncoder) AddTime(k string, v time.Time) {} |
| 113 | +func (m *objectEncoder) AddUint(k string, v uint) {} |
| 114 | +func (m *objectEncoder) AddUint32(k string, v uint32) {} |
| 115 | +func (m *objectEncoder) AddUint16(k string, v uint16) {} |
| 116 | +func (m *objectEncoder) AddUint8(k string, v uint8) {} |
| 117 | +func (m *objectEncoder) AddUintptr(k string, v uintptr) {} |
0 commit comments