Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package
v1.20.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerToSlogHandler

func HandlerToSlogHandler(handler log.Handler) slog.Handler

func HookToHandler

func HookToHandler(hook log.Hook) log.Handler

HookToHandler converts a Hook to a Handler for backward compatibility. Deprecated: Use Handler directly instead, HookToHandler will be removed in v1.18.

func NewWriter

func NewWriter(ctx context.Context, logger *slog.Logger) log.Writer

Types

type Application

type Application struct {
	log.Writer
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(ctx context.Context, channels []string, config config.Config, json foundation.Json, resolver contractstelemetry.Resolver) (*Application, error)

func (*Application) Channel

func (r *Application) Channel(channel string) log.Log

func (*Application) Stack

func (r *Application) Stack(channels []string) log.Log

func (*Application) WithContext

func (r *Application) WithContext(ctx context.Context) log.Log

type Entry

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

func FromSlogRecord

func FromSlogRecord(r slog.Record) *Entry

func (*Entry) Code

func (e *Entry) Code() string

func (*Entry) Context

func (e *Entry) Context() context.Context

func (*Entry) Data

func (e *Entry) Data() log.Data

func (*Entry) Domain

func (e *Entry) Domain() string

func (*Entry) Hint

func (e *Entry) Hint() string

func (*Entry) Level

func (e *Entry) Level() log.Level

func (*Entry) Message

func (e *Entry) Message() string

func (*Entry) Owner

func (e *Entry) Owner() any

func (*Entry) Request

func (e *Entry) Request() map[string]any

func (*Entry) Response

func (e *Entry) Response() map[string]any

func (*Entry) Tags

func (e *Entry) Tags() []string

func (*Entry) Time

func (e *Entry) Time() time.Time

func (*Entry) ToSlogRecord

func (e *Entry) ToSlogRecord() slog.Record

func (*Entry) Trace

func (e *Entry) Trace() map[string]any

func (*Entry) User

func (e *Entry) User() any

func (*Entry) With

func (e *Entry) With() map[string]any

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (r *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (r *ServiceProvider) Register(app foundation.Application)

func (*ServiceProvider) Relationship

func (r *ServiceProvider) Relationship() binding.Relationship

type Writer

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

func (*Writer) Code

func (r *Writer) Code(code string) log.Writer

Code set a code or slug that describes the error.

func (*Writer) Debug

func (r *Writer) Debug(args ...any)

func (*Writer) Debugf

func (r *Writer) Debugf(format string, args ...any)

func (*Writer) Error

func (r *Writer) Error(args ...any)

func (*Writer) Errorf

func (r *Writer) Errorf(format string, args ...any)

func (*Writer) Fatal

func (r *Writer) Fatal(args ...any)

func (*Writer) Fatalf

func (r *Writer) Fatalf(format string, args ...any)

func (*Writer) Hint

func (r *Writer) Hint(hint string) log.Writer

Hint set a hint for faster debugging.

func (*Writer) In

func (r *Writer) In(domain string) log.Writer

In sets the feature category or domain in which the log entry is relevant.

func (*Writer) Info

func (r *Writer) Info(args ...any)

func (*Writer) Infof

func (r *Writer) Infof(format string, args ...any)

func (*Writer) Owner

func (r *Writer) Owner(owner any) log.Writer

Owner set the name/email of the colleague/team responsible for handling this error.

func (*Writer) Panic

func (r *Writer) Panic(args ...any)

func (*Writer) Panicf

func (r *Writer) Panicf(format string, args ...any)

func (*Writer) Request

func (r *Writer) Request(req http.ContextRequest) log.Writer

Request supplies a http.Request.

func (*Writer) Response

func (r *Writer) Response(res http.ContextResponse) log.Writer

Response supplies a http.Response.

func (*Writer) Tags

func (r *Writer) Tags(tags ...string) log.Writer

Tags add multiple tags, describing the feature returning an error.

func (*Writer) User

func (r *Writer) User(user any) log.Writer

User sets the user associated with the log entry.

func (*Writer) Warning

func (r *Writer) Warning(args ...any)

func (*Writer) Warningf

func (r *Writer) Warningf(format string, args ...any)

func (*Writer) With

func (r *Writer) With(data map[string]any) log.Writer

With adds key-value pairs to the context of the log entry.

func (*Writer) WithTrace

func (r *Writer) WithTrace() log.Writer

WithTrace adds a stack trace to the log entry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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