zaplipgloss

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: EUPL-1.2 Imports: 11 Imported by: 1

README

Zap-Lipgloss

Zap-Lipgloss is a custom encoder for zap that uses Charmbracelet/Lipgloss to create a beautiful readable format.

image

package main

import (
    _ "github.com/tvanriel/zaplipgloss" // add the package as _ to register the logger.
	"go.uber.org/zap"
)

func main() {
  logger, err := zap.Config{
    Level: zap.NewAtomicLevelAt(zap.DebugLevel),
    Encoding: "lipgloss", // Set the logger in the config
    OutputPaths: []string{"stdout"},
  }.Build()

}

Documentation

Overview

package zaplipgloss implements a zap encoder that formats its body using charmbracelet lipgloss.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LipglossEncoder

type LipglossEncoder struct {
	// contains filtered or unexported fields
}

func NewLipglossEncoder

func NewLipglossEncoder(cfg zapcore.EncoderConfig) (*LipglossEncoder, error)

NewLipglossEncoder creates a new Lipgloss Zap Encoder.

func (*LipglossEncoder) AddArray

func (l *LipglossEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error

Logging-specific marshalers.

func (*LipglossEncoder) AddBinary

func (l *LipglossEncoder) AddBinary(key string, value []byte)

Built-in types.

func (*LipglossEncoder) AddBool

func (l *LipglossEncoder) AddBool(key string, value bool)

func (*LipglossEncoder) AddByteString

func (l *LipglossEncoder) AddByteString(key string, value []byte)

func (*LipglossEncoder) AddComplex64

func (l *LipglossEncoder) AddComplex64(key string, value complex64)

func (*LipglossEncoder) AddComplex128

func (l *LipglossEncoder) AddComplex128(key string, value complex128)

func (*LipglossEncoder) AddDuration

func (l *LipglossEncoder) AddDuration(key string, value time.Duration)

func (*LipglossEncoder) AddFloat32

func (l *LipglossEncoder) AddFloat32(key string, value float32)

func (*LipglossEncoder) AddFloat64

func (l *LipglossEncoder) AddFloat64(key string, value float64)

func (*LipglossEncoder) AddInt

func (l *LipglossEncoder) AddInt(k string, v int)

func (*LipglossEncoder) AddInt8

func (l *LipglossEncoder) AddInt8(k string, v int8)

func (*LipglossEncoder) AddInt16

func (l *LipglossEncoder) AddInt16(k string, v int16)

func (*LipglossEncoder) AddInt32

func (l *LipglossEncoder) AddInt32(k string, v int32)

func (*LipglossEncoder) AddInt64

func (l *LipglossEncoder) AddInt64(key string, value int64)

func (*LipglossEncoder) AddObject

func (l *LipglossEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error

func (*LipglossEncoder) AddReflected

func (l *LipglossEncoder) AddReflected(key string, value interface{}) error

AddReflected uses reflection to serialize arbitrary objects, so it can be slow and allocation-heavy.

func (*LipglossEncoder) AddString

func (l *LipglossEncoder) AddString(key string, value string)

func (*LipglossEncoder) AddTime

func (l *LipglossEncoder) AddTime(key string, value time.Time)

func (*LipglossEncoder) AddUint

func (l *LipglossEncoder) AddUint(k string, v uint)

func (*LipglossEncoder) AddUint8

func (l *LipglossEncoder) AddUint8(k string, v uint8)

func (*LipglossEncoder) AddUint16

func (l *LipglossEncoder) AddUint16(k string, v uint16)

func (*LipglossEncoder) AddUint32

func (l *LipglossEncoder) AddUint32(k string, v uint32)

func (*LipglossEncoder) AddUint64

func (l *LipglossEncoder) AddUint64(key string, value uint64)

func (*LipglossEncoder) AddUintptr

func (l *LipglossEncoder) AddUintptr(k string, v uintptr)

func (*LipglossEncoder) AppendArray

func (l *LipglossEncoder) AppendArray(arr zapcore.ArrayMarshaler) error

func (*LipglossEncoder) AppendBool

func (l *LipglossEncoder) AppendBool(val bool)

Built-in types.

func (*LipglossEncoder) AppendByteString

func (l *LipglossEncoder) AppendByteString(val []byte)

func (*LipglossEncoder) AppendComplex64

func (l *LipglossEncoder) AppendComplex64(v complex64)

func (*LipglossEncoder) AppendComplex128

func (l *LipglossEncoder) AppendComplex128(v complex128)

func (*LipglossEncoder) AppendDuration

func (l *LipglossEncoder) AppendDuration(val time.Duration)

Time-related types.

func (*LipglossEncoder) AppendFloat32

func (l *LipglossEncoder) AppendFloat32(v float32)

func (*LipglossEncoder) AppendFloat64

func (l *LipglossEncoder) AppendFloat64(v float64)

func (*LipglossEncoder) AppendInt

func (l *LipglossEncoder) AppendInt(v int)

func (*LipglossEncoder) AppendInt8

func (l *LipglossEncoder) AppendInt8(v int8)

func (*LipglossEncoder) AppendInt16

func (l *LipglossEncoder) AppendInt16(v int16)

func (*LipglossEncoder) AppendInt32

func (l *LipglossEncoder) AppendInt32(v int32)

func (*LipglossEncoder) AppendInt64

func (l *LipglossEncoder) AppendInt64(val int64)

func (*LipglossEncoder) AppendObject

func (l *LipglossEncoder) AppendObject(val zapcore.ObjectMarshaler) (_ error)

func (*LipglossEncoder) AppendReflected

func (l *LipglossEncoder) AppendReflected(value any) error

AppendReflected uses reflection to serialize arbitrary objects, so it's slow and allocation-heavy.

func (*LipglossEncoder) AppendString

func (l *LipglossEncoder) AppendString(val string)

func (*LipglossEncoder) AppendTime

func (l *LipglossEncoder) AppendTime(val time.Time)

func (*LipglossEncoder) AppendUint

func (l *LipglossEncoder) AppendUint(v uint)

func (*LipglossEncoder) AppendUint8

func (l *LipglossEncoder) AppendUint8(v uint8)

func (*LipglossEncoder) AppendUint16

func (l *LipglossEncoder) AppendUint16(v uint16)

func (*LipglossEncoder) AppendUint32

func (l *LipglossEncoder) AppendUint32(v uint32)

func (*LipglossEncoder) AppendUint64

func (l *LipglossEncoder) AppendUint64(val uint64)

func (*LipglossEncoder) AppendUintptr

func (l *LipglossEncoder) AppendUintptr(v uintptr)

func (*LipglossEncoder) Clone

func (l *LipglossEncoder) Clone() zapcore.Encoder

Clone copies the encoder, ensuring that adding fields to the copy doesn't affect the original.

func (*LipglossEncoder) EncodeEntry

func (l *LipglossEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

EncodeEntry encodes an entry and fields, along with any accumulated context, into a byte buffer and returns it. Any fields that are empty, including fields on the `Entry` type, should be omitted.

func (*LipglossEncoder) OpenNamespace

func (l *LipglossEncoder) OpenNamespace(key string)

OpenNamespace opens an isolated namespace where all subsequent fields will be added. Applications can use namespaces to prevent key collisions when injecting loggers into sub-components or third-party libraries.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL